S
Scott Reynolds
Hi,
I am using following code to read and generate SQL query based on values in
storedarray. But I am not sure if it is the best way... all suggestions are
welcome!
Thank you!
Scott
Dim SqlQuery As String
Dim SqlCity As String
If Not ItemsArray.Count = 0 Then
For i As Integer = 0 To ItemsArray.Count - 1
If i = 0 Then
SqlCity = "(City =" + ItemsArray(i) + ")"
Else
SqlCity = SqlCity + " Or (City =" + ItemsArray(i) + ")"
End If
Next
SqlCity = "(" & SqlCity & ")"
End If
SqlQuery = "Select * FROM MyTable WHERE " & SqlCity
I am using following code to read and generate SQL query based on values in
storedarray. But I am not sure if it is the best way... all suggestions are
welcome!
Thank you!
Scott
Dim SqlQuery As String
Dim SqlCity As String
If Not ItemsArray.Count = 0 Then
For i As Integer = 0 To ItemsArray.Count - 1
If i = 0 Then
SqlCity = "(City =" + ItemsArray(i) + ")"
Else
SqlCity = SqlCity + " Or (City =" + ItemsArray(i) + ")"
End If
Next
SqlCity = "(" & SqlCity & ")"
End If
SqlQuery = "Select * FROM MyTable WHERE " & SqlCity