I have 3 radio buttons and each connected to a SQL statement..the first one 'NVIDIA*' does not get executed whereas the other two do because they dont have wildcard character in them.

Can you please help me with this ?

I tried 'NVIDIA*' in Access query and they worked perfect

Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click

        Dim con As New OleDbConnection("provider=microsoft.jet.oledb.4.0;data source=C:\Documents and Settings\bashkark\Desktop\Copy of USERS.mdb")

        Dim cmd1 As New OleDbCommand

        con.Open()

        If (RadioButton1.Checked = True) Then

            cmd1 = New OleDbCommand("select * from table1 where GRAPHICSCARD like 'NVIDIA*'", con)

        End If

        If (RadioButton2.Checked = True) Then

            cmd1 = New OleDbCommand("select * from table1 where GRAPHICSCARD='3D LABS WILDCAT 4 7110'", con)

        End If

        If (RadioButton3.Checked = True) Then

            cmd1 = New OleDbCommand("select * from table1 where GRAPHICSCARD = 'ATI FIRE GL2 VIDEO ACCELERATOR'", con)

        End If

        Dim da As OleDbDataAdapter = New OleDbDataAdapter(cmd1)

        Try

            Dim ds As DataSet = New DataSet

            da.Fill(ds, "table1")

            DataGridView1.DataSource = ds.Tables("table1").DefaultView

        Finally

            con.Close()

            cmd1 = Nothing

            da.Dispose()

            con.Dispose()

        End Try

    End Sub

i am sorry..i realized my mistake..it should have been "nvidia%"


I have 3 radio buttons and each connected to a SQL statement..the first one 'NVIDIA*' does not get executed whereas the other two do because they dont have wildcard character in them.

Can you please help me with this ?

I tried 'NVIDIA*' in Access query and they worked perfect


Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click

Dim con As New OleDbConnection("provider=microsoft.jet.oledb.4.0;data source=C:\Documents and Settings\bashkark\Desktop\Copy of USERS.mdb")

Dim cmd1 As New OleDbCommand

con.Open()

If (RadioButton1.Checked = True) Then

cmd1 = New OleDbCommand("select * from table1 where GRAPHICSCARD like 'NVIDIA*'", con)

End If

If (RadioButton2.Checked = True) Then

cmd1 = New OleDbCommand("select * from table1 where GRAPHICSCARD='3D LABS WILDCAT 4 7110'", con)

End If

If (RadioButton3.Checked = True) Then

cmd1 = New OleDbCommand("select * from table1 where GRAPHICSCARD = 'ATI FIRE GL2 VIDEO ACCELERATOR'", con)

End If

Dim da As OleDbDataAdapter = New OleDbDataAdapter(cmd1)

Try

Dim ds As DataSet = New DataSet

da.Fill(ds, "table1")

DataGridView1.DataSource = ds.Tables("table1").DefaultView

Finally

con.Close()

cmd1 = Nothing

da.Dispose()

con.Dispose()

End Try

End Sub

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.