question

prasadk-6267 avatar image
0 Votes"
prasadk-6267 asked CinarBakan-9446 commented

System.Data.SqlClient.SqlException ----A transport-level error has occurred when receiving results from the server

I am getting below issue while performing bulk copy in c#

System.Data.SqlClient.SqlException (0x80131904): A transport-level error has occurred when receiving results from the server. (provider: TCP Provider, error: 0 - The specified network name is no longer available.) ---> System.ComponentModel.Win32Exception (0x80004005): The specified network name is no longer available at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)

using (SqlBulkCopy bulkCopy = new SqlBulkCopy(connectionstr, SqlBulkCopyOptions.KeepIdentity))

         {
             bulkCopy.DestinationTableName = Table;
             bulkCopy.BulkCopyTimeout = 0;

             foreach (DataColumn dccolumn in dccolumns)
             {
                 bulkCopy.ColumnMappings.Add(dccolumn.ColumnName, dccolumn.ColumnName);
             }

             // Write from the source to the destination.       

         
             bulkCopy.WriteToServer(dt);

             bulkCopy.Close();
         }
     }


Please advise.

sql-server-generaldotnet-csharpdotnet-aspnet-webforms
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

hi @prasadk-6267,

what was the solution ? this is problem ? same my app :(

0 Votes 0 ·
Yufeishao-MSFT avatar image
0 Votes"
Yufeishao-MSFT answered

Hi @prasadk-6267,

It may not be a statement issue, it could be a network related issue with the service provider, your application is unable to connect the database engine. Check your firewall for any blocked setting and raise it with your service provider.

You also can check your error log first to see if there are any messages which seem to correlate with this error. Try to use DBCC to check if there is any corruption in the database: https://docs.microsoft.com/en-us/sql/t-sql/database-console-commands/dbcc-checkdb-transact-sql?view=sql-server-ver15

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

ErlandSommarskog avatar image
0 Votes"
ErlandSommarskog answered

Check the SQL Server log to see if there are error messages that correlates in time with these events.

If there is not, I'm inclined to agree with Yufei that it is a network issue.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.