views:

127

answers:

1

Here is my code:

Dim connectionString As String ="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=F:\ACCESS DATABASE\search.mdb"

Dim selectCommand As String
Dim connection As New OleDbConnection(connectionString)

selectCommand = "select * from GH  WHERE (COURSE='BSIT')"
Me.dataAdapter = New OleDbDataAdapter(selectCommand, connection)

I want to know how to use a textbox to filter data. Because this code will have to enumerate all of the courses, and will need much buttons.

A: 

No sure I understand the question correct. Try this

selectCommand = "select * from GH  WHERE (COURSE='" & TextBox1.Text & "')"

Also you need to avoid single quotes(') on the textbox.

Anuraj
thanks!it works
Mark it as answer, if you got the solution.
Anuraj
Er, @Remou, is the caveate about the .Text property applicable in VB.NET, which is the programming environment here? It *is* relevant within Access/VBA, but I wouldn't assume it would be in VB.NET, as in VB6 and before, the .Text property was equivalent to the Access .Value property (so far as I understand VB forms programming).
David-W-Fenton