0

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

2
Contributors
1
Reply
2
Views
8 Years
Discussion Span
Last Post by RipperJT
0

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)
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.