Hi,
Im trying to write a program that pulls in 3 tables from SQL Server and then checks those tables for specific values.
the code below is working when i try to find an operator in the operators table:
The problem I'm having is how to find a value that isn't exact, i.e. in SQL my statement to search was as below:
the code below just searches for an exact match, how do I code the above SQL statement?
Im trying to write a program that pulls in 3 tables from SQL Server and then checks those tables for specific values.
the code below is working when i try to find an operator in the operators table:
VB.NET:
Dim dv As DataView
Dim iOp As String = Mid(LineText, 5, 3)
dv = New DataView(ds.Tables("dbOperator"))
dv.Sort = "OperatorCode"
Dim NumberFound As Integer = dv.Find(iOp)
If NumberFound = -1 Then
ValidOp = False
Else
ValidOp = True
End If
The problem I'm having is how to find a value that isn't exact, i.e. in SQL my statement to search was as below:
VB.NET:
"SELECT 1 FROM dbo.servd WHERE SUBSTRING(route,1,4) = " & "'" & iRoute & "'"
the code below just searches for an exact match, how do I code the above SQL statement?
VB.NET:
Dim dv As DataView
Dim iRoute As String = Mid(LineText, 9, 4)
iRoute = iRoute.TrimStart("0c")
dv = New DataView(ds.Tables("dbServD"))
dv.Sort = "Route"
Dim NumberFound As Integer = dv.Find(iRoute)
If NumberFound = -1 Then
ValidRoute = False
Else
ValidRoute = True
End If