1
在下面的例子中,CommandTimeout = 5
似乎沒有幫助,如果WiFi連接被丟棄。不幸的是,即使在這種情況下,sqlConnection仍然有State
的Open
。當WiFi下降時,CommandTimeout沒有被使用
真正的問題是暫停似乎是無限的,它只是坐在那裏..掛。我無法讓它迴歸。 cmd_GetItem.ExecuteNonQuery()
之後的代碼永遠不會被調用,它只是掛在那裏。
任何想法?
With cmd_GetItem
.Connection = con
.CommandType = Data.CommandType.StoredProcedure
.CommandText = "spGetItem"
.CommandTimeout = 5
.Parameters.AddWithValue("@ScanData", Scan_Number)
.Parameters.Add("@RecordCount", SqlDbType.Int).Value = DBNull.Value
.Parameters("@RecordCount").Direction = ParameterDirection.Output
End With
Try
MsgBox(con.State & " - " & con.State.ToString())
cmd_GetItem.ExecuteNonQuery()
'snip