SQL Server 2005 Timeout Expired Error
The following function is used to que开发者_运维技巧ry the records that are "Send To Computer" and records that are not "Gazetted" .
When this query is run the following error occurs:
"Time expired. The timeout period elapsed prior to completion of the operation or the server not responding"
How can I solve this error?
My Code and data are:
LandParcels Table.
Blockid ParcelNo Actions
51024401 10 Send to Computer
51024401 11 Send to Computer
51024401 10 Gazetted
51024401 13 Send to Computer
51024401 14 Send to Computer
51024401 15 Send to Computer
51024401 15 Gazetted`
Result should be:
LandParcels Table.
Blockid ParcelNo Actions
51024401 11 Send to Computer
51024401 13 Send to Computer
51024401 14 Send to Computer
Public Function loadLPforGazette(ByVal blockID As Integer) As DataSet
Dim sql As String
sql = "select a.blockid, a.parcelno, a.schedulefileno from landparcels a "
sql = sql + "join actions b on(a.blockid = b.blockid and a.parcelno = b.parcelno) "
sql = sql + "where b.blockid = " & blockID & " and b.actiontaken = 'Send To Computer' "
sql = sql + "and not exists(select 'x' from actions x "
sql = sql + "where x.actiontaken = 'Gazetted' "
sql = sql + "and b.blockid = x.blockid and b.parcelno = x.parcelno) order by a.blockid, a.parcelno"
'********************* Load LandParcel Table **************************************************
myDALand = New SqlDataAdapter(sql, sqlCon)
myDSLand = New DataSet()
myDALand.Fill(myDSLand, "Landparcles")
'********************* End Load LandParcel Table ***********************************
loadLPforGazette = myDSLand
End Function
精彩评论