I have been building an address book prog for my company. I followed this tutorial which I think is excellent. If I can follow it and get it to work, anyone can. It's answered several questions I had as well. I wanted to expand on the basic address book and put on a search button but to no avail. My code for the button is this
The address books perfectly so the code I have is OK apart from the search button. I assume it's just a case of filling the textboxes with fields but where am I going wrong?
TIA
Code:
Private Sub btnSearch_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSearch.Click
con.ConnectionString = "PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source = C:\AddressBook.mdb"
con.Open()
sql = "SELECT * FROM tblContacts WHERE Surname = '" & SurnameTextBox.Text & "' "
da = New OleDb.OleDbDataAdapter(sql, con)
con.Close()
da.Fill(ds, "AddressBook")
MaxRows = ds.Tables("AddressBook").Rows.Count
inc = -1
End Sub
The address books perfectly so the code I have is OK apart from the search button. I assume it's just a case of filling the textboxes with fields but where am I going wrong?
TIA