the code worked perfect on Friday and when I come back today and try.. the RAM alone works fine in the T-SQL but the Mfg, Make, GraphicsCard and GraphicsVersion do not work atall.. they dont give me any queries atall in the data grid view o/p..

why am i stuck ? Any reason ?

i am surprised..it worked fine on Friday..! :(((

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

Dim con As OleDbConnection = New OleDb.OleDbConnection("provider=microsoft.jet.oledb.4.0;data source=Z:\CAD\Copy of USERS.mdb")

Dim cmd As New OleDbCommand

cmd = New OleDbCommand("Select * from table1 Where Mfg Like '%" & ComboBox1.SelectedItem & "%' And Make Like '%" & ComboBox2.SelectedItem & "%' And RAM Like '%" & ComboBox3.SelectedItem & "%' And GraphicsCard Like '%" & ComboBox4.SelectedItem & "%' And GraphicsVersion Like '%" & ComboBox5.SelectedItem & "%'", con)

con.Open()

Dim da As OleDbDataAdapter = New OleDbDataAdapter(cmd)

Try

Dim ds As DataSet = New DataSet()

ds.Tables.Add("table1")

da.Fill(ds, "table1")

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

Finally

con.Close()

cmd = Nothing

da.Dispose()

con.Dispose()

End Try

End Sub

It works now again.. but why is this on and off again and again ??

any reasons ?? Pls assist!! :((

hello folks:

I tried executing this..i get no errors and I can see the fields alone in my datagrid view with no data in it..

ia m not sure what;s wrong with the code..

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click

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

Dim cmd As New OleDbCommand

cmd = New OleDbCommand("Select MFG,MAKE,GRAPHICSCARD, GRAPHICSVERSION from table2 Where MFG = '%" & ComboBox1.SelectedItem & "%' And MAKE ='%" & ComboBox2.SelectedItem & "%' And GRAPHICSCARD = '%" & ComboBox3.SelectedItem & "%' And GRAPHICSVERSION = '%" & ComboBox4.SelectedItem & "%'", con)

con.Open()

Dim da As OleDbDataAdapter = New OleDbDataAdapter(cmd)

Try

Dim ds As DataSet = New DataSet()

ds.Tables.Add("table2")

da.Fill(ds, "table2")

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

Finally

con.Close()

cmd = Nothing

da.Dispose()

con.Dispose()

End Try

End Sub

End Class

Kav,

Change your cmd to this: cmd = New OleDbCommand("Select * from table1 Where Mfg Like %'" & ComboBox1.SelectedItem & "'% And Make Like %'" & ComboBox2.SelectedItem & "'% And RAM Like %'" & ComboBox3.SelectedItem & "'% And GraphicsCard Like %'" & ComboBox4.SelectedItem & "'% And GraphicsVersion Like %'" & ComboBox5.SelectedItem & "'%'", con) See if that works.

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.