I have developed this database frontend and am having this issue sometimes.
When I search for a serial # in my DB, sometimes I get the error "Cannot perform = operation on system.string and int32
What I cannot understand is this works for many serial #'s and does not work for others. Below is my code, is there a better way of doing this?
I have tried taking out the cast to an integer but it did not work. I have wrapped the serial # in single quotes but then it never finds any records. Even records that currently work are not found when wrapped in single quotes. Is there a way to parameterize this so that it works better?
When I search for a serial # in my DB, sometimes I get the error "Cannot perform = operation on system.string and int32
What I cannot understand is this works for many serial #'s and does not work for others. Below is my code, is there a better way of doing this?
VB.NET:
Dim foundrows() As DataRow
Dim thatserial = CInt(SerialTB.Text)
Dim SerialSql As String = "[SerialNO] = " & (thatserial)
'SerialSql = SerialSql & thatserial
Dim SortDate As String = "dt"
foundrows = dsCallLog.Tables("Call Log Sub").Select(SerialSql, SortDate)
I have tried taking out the cast to an integer but it did not work. I have wrapped the serial # in single quotes but then it never finds any records. Even records that currently work are not found when wrapped in single quotes. Is there a way to parameterize this so that it works better?