i tried putting in actual values and it works..this code gives results of RAM > 0.500 and less than and equal to 2.000 but how do i make it parametrized ???????????????????

Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click

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

Dim cmd1 As New OleDbCommand

cmd1 = New OleDbCommand("select * from table1 where RAM between 0.500 and 2.000", con)

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

I can't test this right now but it should give you direction...

cmd1 = New OledbCommand("SELECT * FROM TABLE1 WHERE ((Ram >= @minRam) AND (Ram <= @maxRam))", con)

cmd1.Parameters.Add("@minRam", ComboBox6.SelectedItem)

cmd1.Parameters.Add("@maxRam", ComboBox7.SelectedItem)
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.