Hi, I'm really new at database programming. I've got VB.net and I'm working on a very simple practice program that is linked to a Access Database. I have a database that I set up with just a Primary key called "ID" , a last name and first name column called "LastName" and "FirstName". I'm able to link everything up and I can get the data to fill a datagrid, or a combo box just fine before I write the SQL satement, but after I write the Select SQL statement that is associated with the LastName I try to fill data grids and such and there it won't display any data. The SQL statement is Select FirstName, LastName Where LastName = "lname"
This is the code to fill:
The "if" statement is supposed to fill 2 other labels that are bound to the first and last name columns and fill them with the information that is limited by the Select statement. For some reason no data is showing as soon as I input the SQL statement, but when I take the statement out, it stops displaying any data at all. Can anyone help?
This is the code to fill:
Code:
'This starts the combo box off
oledbdatabase1.fill(dataset11)
combobox1.SelectedIndex = -1
If combobox1.SelectedIndex <> -1 Then
dataset11.Clear() oledbdataadapter1.SelectCommand.Parameters("lname").Value = combobox1.Text
oledbdataadapter1.Fill(dataset11)
End if
The "if" statement is supposed to fill 2 other labels that are bound to the first and last name columns and fill them with the information that is limited by the Select statement. For some reason no data is showing as soon as I input the SQL statement, but when I take the statement out, it stops displaying any data at all. Can anyone help?