Second call of an SQL query throws a syntax error?

  • Thread starter Thread starter ColtsFanMN
  • Start date Start date
C

ColtsFanMN

Guest
Private Sub RefreshDataSet()

Dim strSQL As String = DataAdapter1.SelectCommand.CommandText
Try

DataSet1.Clear()
DataAdapter1.SelectCommand.CommandText() = Trim(strSQL & " WHERE BadgeID = " & strEmployeeBadge)
DataAdapter1.Fill(DataSet1)

Catch ex As Exception

MsgBox(ex.Message)

End Try
End Sub


When I call the above procedure, the sub does work correctly and I get the expected results / records in the dataset. But, when I call the Sub again (to refresh the dataset) it gives me an "incorrect syntax" error.

Im not sure why it is doing this. Any suggestions or ideas?

Continue reading...
 
Back
Top