S
Shane Brodie
Either MSDE or ADO.Net hangs when I rapidly run a series of identical
database reads. The only useful message I get is
System.InvalidOperationException which tells me I have a timeout somewhere.
But, where?
Here is the database related code that is being executed.
'***** SNIP *****
objCN.Open()
objCmd.Connection = objCN
objCmd.CommandType = CommandType.Text
objReader = objCmd.ExecuteReader
If objReader.HasRows Then
objReader.Read()
'ignore changed events whie loading
Loading = True
tctOrder.Tag = objReader.GetValue(0)
tabCustomer.Tag = objReader.GetValue(1)
txtSumOrderID.Text = OrderID
txtSumOrderStatus.Text = objReader.GetString(7)
txtSumSubmissionDate.Text = Format(objReader.GetDateTime(3), "dddd MMMM dd,
yyyy")
......
objReader.Close()
objReader = Nothing
objCmd.Dispose()
objCN.Close()
objCN.Dispose()
' ***** END SNIP *****
Then ...
'**** SNIP *****
Try
objCN.Open()
objCmd.Connection = objCN
objCmd.CommandType = CommandType.Text
objReader = objCmd.ExecuteReader
If objReader.HasRows Then
While objReader.Read
nodGroup = nodRoot.Nodes.Add(objReader.GetString(1))
nodGroup.Tag = "GRP" & objReader.GetValue(0)
nodGroup.Expand()
End While
End If
objReader.Close()
objReader = Nothing
Catch sqlEx As SqlClient.SqlException
MsgBox(sqlEx.ToString)
Catch ex As Exception
MsgBox(ex.ToString)
End Try
Try
objCmd = New SqlClient.SqlCommand("SELECT * FROM vwGroupOrderItems WHERE
OrderID = " & CType(tctOrder.Tag, Long) & ";")
objCmd.Connection = objCN
objCmd.CommandType = CommandType.Text
objReader = objCmd.ExecuteReader
If objReader.HasRows Then
While objReader.Read
nodGroup = GetGroup("GRP" & objReader.GetValue(1))
nodItem = nodGroup.Nodes.Add(objReader.GetString(6) & " - " &
objReader.GetString(4))
nodItem.Tag = "ITM" & objReader.GetValue(0)
End While
End If
Catch sqlEx As SqlClient.SqlException
MsgBox(sqlEx.ToString)
Catch ex As Exception
MsgBox(ex.ToString)
End Try
tvwOrderDetail.EndUpdate()
tvwOrderDetail.ExpandAll()
'***** END SNIP *****
Regards
Shane Brodie
database reads. The only useful message I get is
System.InvalidOperationException which tells me I have a timeout somewhere.
But, where?
Here is the database related code that is being executed.
'***** SNIP *****
objCN.Open()
objCmd.Connection = objCN
objCmd.CommandType = CommandType.Text
objReader = objCmd.ExecuteReader
If objReader.HasRows Then
objReader.Read()
'ignore changed events whie loading
Loading = True
tctOrder.Tag = objReader.GetValue(0)
tabCustomer.Tag = objReader.GetValue(1)
txtSumOrderID.Text = OrderID
txtSumOrderStatus.Text = objReader.GetString(7)
txtSumSubmissionDate.Text = Format(objReader.GetDateTime(3), "dddd MMMM dd,
yyyy")
......
objReader.Close()
objReader = Nothing
objCmd.Dispose()
objCN.Close()
objCN.Dispose()
' ***** END SNIP *****
Then ...
'**** SNIP *****
Try
objCN.Open()
objCmd.Connection = objCN
objCmd.CommandType = CommandType.Text
objReader = objCmd.ExecuteReader
If objReader.HasRows Then
While objReader.Read
nodGroup = nodRoot.Nodes.Add(objReader.GetString(1))
nodGroup.Tag = "GRP" & objReader.GetValue(0)
nodGroup.Expand()
End While
End If
objReader.Close()
objReader = Nothing
Catch sqlEx As SqlClient.SqlException
MsgBox(sqlEx.ToString)
Catch ex As Exception
MsgBox(ex.ToString)
End Try
Try
objCmd = New SqlClient.SqlCommand("SELECT * FROM vwGroupOrderItems WHERE
OrderID = " & CType(tctOrder.Tag, Long) & ";")
objCmd.Connection = objCN
objCmd.CommandType = CommandType.Text
objReader = objCmd.ExecuteReader
If objReader.HasRows Then
While objReader.Read
nodGroup = GetGroup("GRP" & objReader.GetValue(1))
nodItem = nodGroup.Nodes.Add(objReader.GetString(6) & " - " &
objReader.GetString(4))
nodItem.Tag = "ITM" & objReader.GetValue(0)
End While
End If
Catch sqlEx As SqlClient.SqlException
MsgBox(sqlEx.ToString)
Catch ex As Exception
MsgBox(ex.ToString)
End Try
tvwOrderDetail.EndUpdate()
tvwOrderDetail.ExpandAll()
'***** END SNIP *****
Regards
Shane Brodie