I have a program in which I want to have the user enter two percentages and display the data matching the criteria on a new form. The query would be:
The way I currently have it written is to display only one row of data. I need to display any number of rows that meet this criteria. My current code is:
This will open the new form and put the information in the textboxes I have. However, I never know how many textboxes I will need to display.
My questions are:
1. How can I do my query to incorporate the user entered criteria (in the where statement)?
2. How can I display ALL of the data instead of just one line?
Thank you for any help you can give.
Rhonda
Code:
Select *
From Corrosion
Where corrpct1 >= {column in database} OR
corrpct2 >= {column in database}
Code:
Private Sub btnDetails_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDetails.Click
Dim form As New frmDetails()
Me.Hide()
form.Show()
Try
cn = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=C:\Corrosion.mdb;")
cn.Open()
cmd = New OleDbCommand("select * from Corrosion", cn)
dr = cmd.ExecuteReader
While dr.Read()
form.txtID.Text = dr(0)
form.txtCountry.Text = dr(1)
form.txtCompany.Text = dr(2)
form.txtAsset.Text = dr(3)
form.txtBlock.Text = dr(4)
form.txtFacility.Text = dr(5)
form.txtAreaItem.Text = dr(6)
form.txtCode.Text = dr(7)
End While
Catch
End Try
dr.Close()
cn.Close()
End Sub
My questions are:
1. How can I do my query to incorporate the user entered criteria (in the where statement)?
2. How can I display ALL of the data instead of just one line?
Thank you for any help you can give.
Rhonda
Comment