I have a app to manage workflow at my work company, and a few days ago one table stopped loading. I have searched for help on various platforms and so far found none. I have a private 2016 SQL server that a connect to.
My Connection SQL Command:
Public Shared Sub Load(ByRef MyCollect As List(Of PaintSheetItem), Filter As String, OrderBy As String)
MyCollect = New List(Of PaintSheetItem)
Dim CMDValue As String = $"SELECT * FROM {TableName}"
If Filter IsNot Nothing Then CMDValue &= $" WHERE {Filter}"
If OrderBy IsNot Nothing Then CMDValue &= $" ORDER BY {OrderBy}"
CMDValue &= ";"
If SQLCon.State = System.Data.ConnectionState.Closed Then SQLCon.Open()
Using CMD As New SqlCommand(CMDValue, SQLCon)
Using reader As SqlDataReader = CMD.ExecuteReader()
Try
If reader.HasRows Then
While reader.Read()
Dim LF As New PaintSheetItem With {.Id = reader(0),
.PSDId = reader(1),
.KeyNo = reader(2),
.BaseKeyNo = reader(3),
.Description = reader(4),
.QTYOrd = reader(5),
.QTYShip = reader(6),
.NoCTNs = reader(8),
.Length = reader(9),
.LineWeight = reader(10),
.CustomColor = CompensateForSQLNull(FieldType.String, reader(11)),
.Notes = CompensateForSQLNull(FieldType.String, reader(12))}
LF.HasChanges = False
MyCollect.Add(LF)
End While
End If
Catch ex As Exception
If Not SQLCon.State = System.Data.ConnectionState.Closed Then SQLCon.Close()
Finally
reader.Close()
CMD.Dispose()
If Not SQLCon.State = System.Data.ConnectionState.Closed Then SQLCon.Close()
End Try
End Using
End Using
If Not SQLCon.State = System.Data.ConnectionState.Closed Then SQLCon.Close()
End Sub
The Errors I get are:
1) A severe error occurred on the current command. The results, if any, should be discarded.
2) The relationship between the two objects cannot be defined because they are attached to different ObjectContext object. {This loades the data into a listbox, it hase a parent table/listbox and that parent has its parent table/listbox}
3) ExecuteReader requires an open and available Connection. The connection's current state is open. {This error message is a bit confusing}
4) On the Server I get this Error: The server will drop the connection, because the client driver has sent multiple requests while the session is in single-user mode. This error occurs when a client sends a request to reset the connection while there are batches still running in the session, or when the client sends a request while the session is resetting a connection. Please contact the client driver vendor.
What I have tried:
I have tried using SQLLight to my load my data, and just sql commands. both don't load. It was working without issues for about 15 years and now this. There are eight computers connecting to the server, each updating, viewing and manipulating data. The thought that the server might have issues crossed my mind for it's over 6 years old. I don't know what to make of the server error, does that signifies I need to implant an await statement? not sure how to implement those into that shared class.