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

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)


Dim da As OleDbDataAdapter = New OleDbDataAdapter(cmd)


Dim ds As DataSet = New DataSet()


da.Fill(ds, "table1")

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



cmd = Nothing



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..

This article has been dead for over six months. Start a new discussion instead.