Hi. I have a couple of combo boxes. Any combination chosen from the combobox works. I am getting 2 errors in it.

error1: When I chose RAM as 2.98 i get 4 results

but when i chose RAM as 8 I get 2 records of 8 gb and the 4 results of 2.98 too! why is that ?

error2 : when i dont choose anything atall from any of the combo boxes, and just hit "click" in the form, the form still displays a few records in the datagridview.!

pls advise !!
Kukks!!

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

You shouldn't use LIKE when comparing numeric values. I would start by using something else there....

Hi Adam

thanks for the reply..it works fine for all decimals except for 8.. i believe that the '8' in 2.98 is posing a problem..please let me know..

share ur thoughts..i'll be glad..

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.