Quantcast
Channel: Windows Forms Data Controls and Databinding forum
Viewing all articles
Browse latest Browse all 2535

Second call of an SQL query throws a syntax error?

$
0
0

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?


Viewing all articles
Browse latest Browse all 2535

Trending Articles