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!! :((

Recommended Answers

All 2 Replies

Hello,

If you're getting a recordset back with no data that is an indicator that something is wrong with your SQL syntax.

I'd put a break in the code and see exactly what string you are passing to the connection and work from there. Try throwing in some logic to correct potentially bad conditions in your comboboxes etc. I bet that is where your problem is coming from.

Let us know how it works out.

Sure cutepinkbunnies...i shall try the same and update you.. thanks

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.