Private Sub RefreshDataSet() Dim strSQL As String = DataSet1.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.
I'm not sure why it is doing this. Any suggestions or ideas?