Hi, new to these foruns, sorry if this is in the wrong place
Okayy, basically i'm designing a program atm for my college coursework, and have been trying to get a search button to work. Basically, I need a way so that after the customer id has been found, my variable (in this case inc) needs to set itself to the row which the customer id that has been found is in. the idea is that it finds the row, and fills in the textboxes which i have with the data Here's the bit of code i have atm:
(And btw, inc is set as an integer earlier on in the program)
etc...
hopefully with the text WHATEVER THE ROW NUMBER IS being replaced by actual code to get it to that row.
Also, if this is not possible, can anyone suggest a better way of doing it?
Thanks in advance for any help
Okayy, basically i'm designing a program atm for my college coursework, and have been trying to get a search button to work. Basically, I need a way so that after the customer id has been found, my variable (in this case inc) needs to set itself to the row which the customer id that has been found is in. the idea is that it finds the row, and fills in the textboxes which i have with the data Here's the bit of code i have atm:
(And btw, inc is set as an integer earlier on in the program)
VB.NET:
Dim CustomerID As Integer
'asks for the customer's ID number so that their results can be found.
CustomerID = Val(InputBox("what is the Customer number?"))
Try
Sql = "Select * from tblQuotes WHERE CustomerID = " & CustomerID
'dataAdapter obtains data from database
da = New OleDbDataAdapter(Sql, con)
da.Fill(ds, "CustomerID")
'count number of rows(records) in the dataset
'finds the row which the customer id is in
inc =WHATEVER THE ROW NUMBER IS
If ds.Tables("CustomerID").Rows.Count > 0 Then
TxtName.Text = ds.Tables("TblQuotes").Rows(inc).Item("CustomerName")
TxtHouse.Text = ds.Tables("TblQuotes").Rows(inc).Item("HouseNumberName")
TxtTown.Text = ds.Tables("TblQuotes").Rows(inc).Item("TownCity")
hopefully with the text WHATEVER THE ROW NUMBER IS being replaced by actual code to get it to that row.
Also, if this is not possible, can anyone suggest a better way of doing it?
Thanks in advance for any help
Last edited by a moderator: