0

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
1
Contributor
1
Reply
3
Views
8 Years
Discussion Span
Last Post by kavithabhaskar
0

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

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.