C
C Downey
Hi Guys,
I am well into development of an ASP.NET application.
I have it built so I have a DAL that talks to my codebehind pages, which
determine what to write out to the screen. All my data classes use stored
procedures.
90% of the time this code works but sometimes I get errors(If I sit and hit
refresh 100 times, I will get errors approx 10 times):
The errors are
- Internal connection fatal error, System.Data at
System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior cmdBehavior,
RunBehavior runBehavior, Boolean returnStream)
- A severe error occurred on the current command. The results, if any,
should be discarded. .Net SqlClient Data Provider at
System.Data.SqlClient.SqlCommand.ExecuteReader
These all seem to be SQL Server connection problems associated with the
SQLCommand.ExecuteReader.
An example method from my Data Access Layer class is below:
Any help would be greatly appreciated!
Public Function getUserPreferenceIDs() As ArrayList
Dim conn As New SqlConnection(Common.ConnString)
Dim cmd As SqlCommand
Dim para As SqlParameter
Dim dr As SqlDataReader
Dim arr As New ArrayList()
conn.Open()
cmd = New SqlCommand("portGetUserPreferenceIDs", conn)
cmd.CommandType = CommandType.StoredProcedure
para = cmd.Parameters.Add(New SqlParameter("@contactID",
SqlDbType.Int))
para.Direction = ParameterDirection.Input
para.Value = _contactid
dr = cmd.ExecuteReader
Do While dr.Read()
If Not dr("ID").Equals(System.DBNull.Value) Then
arr.Add(dr("ID"))
End If
Loop
dr.Close()
conn.Close()
Return arr
End Function
I am well into development of an ASP.NET application.
I have it built so I have a DAL that talks to my codebehind pages, which
determine what to write out to the screen. All my data classes use stored
procedures.
90% of the time this code works but sometimes I get errors(If I sit and hit
refresh 100 times, I will get errors approx 10 times):
The errors are
- Internal connection fatal error, System.Data at
System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior cmdBehavior,
RunBehavior runBehavior, Boolean returnStream)
- A severe error occurred on the current command. The results, if any,
should be discarded. .Net SqlClient Data Provider at
System.Data.SqlClient.SqlCommand.ExecuteReader
These all seem to be SQL Server connection problems associated with the
SQLCommand.ExecuteReader.
An example method from my Data Access Layer class is below:
Any help would be greatly appreciated!
Public Function getUserPreferenceIDs() As ArrayList
Dim conn As New SqlConnection(Common.ConnString)
Dim cmd As SqlCommand
Dim para As SqlParameter
Dim dr As SqlDataReader
Dim arr As New ArrayList()
conn.Open()
cmd = New SqlCommand("portGetUserPreferenceIDs", conn)
cmd.CommandType = CommandType.StoredProcedure
para = cmd.Parameters.Add(New SqlParameter("@contactID",
SqlDbType.Int))
para.Direction = ParameterDirection.Input
para.Value = _contactid
dr = cmd.ExecuteReader
Do While dr.Read()
If Not dr("ID").Equals(System.DBNull.Value) Then
arr.Add(dr("ID"))
End If
Loop
dr.Close()
conn.Close()
Return arr
End Function