No exception raised on connection.open() while disconnected with the database

F

Farrukh

Hi All!

I have a problem when connecting to a remote SQL Server
database through .NET Sql Data Provider (using

system.data.sqlclient).

The situation is that the client machine's network
connection is explicitly broken once after successfull
retrival of records

from the database.
So when the following line of code runs after the
connection is broken:

sqlConnection.Open();

....it dont gives any exception. However after that the
exception is raised when querying the database. i.e. at:

sqlDataAdapter.Fill(dataTable);
...


(Note that Connection Pooling is enabled)

Exception raised is:
"General network error. Check your network documentation."

Stack Trace:
at System.Data.SqlClient.SqlCommand.ExecuteReader
(CommandBehavior cmdBehavior, RunBehavior runBehavior,
Boolean returnStream)
at System.Data.SqlClient.SqlCommand.ExecuteReader
(CommandBehavior behavior)
at
System.Data.SqlClient.SqlCommand.System.Data.IDbCommand.Ex
ecuteReader(CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.FillFromCommand
(Object data, Int32 startRecord, Int32 maxRecords, String
srcTable,

IDbCommand command, CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.Fill(DataTable
dataTable, IDbCommand command, CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.Fill(DataTable
dataTable)
at ....

Kindly help me finding a solution to handle this problem.

Looking forward

Regards,
Farrukh
 
R

Ravikanth[MVP]

Hi

Are you trying to connect to default instance/ named
instance of sql server?

Ravikanth
 
D

David Browne

Farrukh said:
Hi All!

I have a problem when connecting to a remote SQL Server
database through .NET Sql Data Provider (using

system.data.sqlclient).

The situation is that the client machine's network
connection is explicitly broken once after successfull
retrival of records

from the database.
So when the following line of code runs after the
connection is broken:

sqlConnection.Open();

...it dont gives any exception. However after that the
exception is raised when querying the database. i.e. at:

sqlDataAdapter.Fill(dataTable);
...


(Note that Connection Pooling is enabled)

Exception raised is:
"General network error. Check your network documentation."

In your connection string, do you have "Connection Reset" turned off?

If so, turn it back on.
David
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top