Internal connection fatal error

G

Guest

We are running a asp.net site, we are using a tiered architecture with the data class looking like

Function MyDataReader(ByVal stylemainid As Int32, ByVal letter As String) As SqlDataReade
Dim myConnection As SqlConnection = New SqlConnection(ConfigurationSettings.AppSettings("connectionString")
myConnection.Open(
Dim myCommand As SqlCommand = New SqlCommand("", myConnection
myCommand.CommandType = CommandType.StoredProcedur
Dim styleparam As SqlParameter = New SqlParameter("@stylemainid", SqlDbType.Int
styleparam.Value = stylemaini
myCommand.Parameters.Add(styleparam
Dim styleparam2 As SqlParameter = New SqlParameter("@letter", SqlDbType.Char
styleparam2.Value = lette
myCommand.Parameters.Add(styleparam2
Return myCommand.ExecuteReader(CommandBehavior.CloseConnection
End Functio

The problem we have it intermitten errors from the try, catch block and they report:

System.InvalidOperationException: Internal connection fatal error
at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream
at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior
at vs2.MyDataReader.RunASQLStatement_ReturnReader(String sql
at vs2.icart.AddTuneToCart(
at vs2.icart.Page_Load(Object sender, EventArgs e

We have tried everything, even rewritten the data access, basically we have a test page the refreshes every 30 seconds and re-reads a table and sure enough it will just work then suddenly display the above errors. please help.
 
K

Ken Cox [Microsoft MVP]

You're probably doing this already, but I wanted to check whether you are
closing your datareader appropriately after using it.

CommandBehavior.CloseConnection closes the Connection object when the
associated DataReader object is closed. Is it possible that you are running
out of connections? Can you monitor the connection count?
 

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

Members online

Forum statistics

Threads
473,962
Messages
2,570,134
Members
46,690
Latest member
MacGyver

Latest Threads

Top