Re: A transport-level error when calling SqlCommand.ExecuteNonQuery()



It look you lost connection with the SQL Server.

You may get this error when you were working with SSMS too. You click New Query and type queries against your database but when your connection expries, you get that error and you need to click that New Query button to establish a new connection to your SQL Server.

You may want to increase connection timeout in your connection string.

--
Ekrem Önsoy



"Roy" <Roy@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message news:410EFB43-F985-4583-B79B-79A1BC39D568@xxxxxxxxxxxxxxxx
I have a stored procedure with some input parameter and one output parameter.
I use SqlCommand and SqlParameter as following

///Set some imput parameters here

parameter = cmd.CreateParameter();
parameter.ParameterName = "OutputParameter";
parameter.DbType = DbType.String;
parameter.Size = 16;
parameter.Direction = ParameterDirection.Output;
cmd.Parameters.Add(parameter);

cmd.ExecuteNonQuery();


However, the last statement generate the following error and the connection
closed because of that:

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.)

Any ideas?

.


Loading