1 Attachment(s)
VB 2010: Need help with Searching and Pulling out records from a specific row
:wave:
I am coding on Visual Basic 2010 and need some help.
My Access database table has following information:
FirstName
LastName
PhoneNumber
Basically what I am trying to do is create a Search function where the user will enter a First and Last Name in the search boxes and upon hitting the ''Search'' button the program will look through the database and check if the records exists.
If the record does exist then I want the Phone number to appear in a separate textbox which is named txtPhoneN.
I have included the code I use to connect to the Database. I have already managed code the part to Add new record to the database.
Also I have attached the work I have currently done to this thread
Code:
Dim inc As Integer
Dim MaxRows As Integer
Dim con As New OleDb.OleDbConnection
Dim dbProvider As String
Dim dbSource As String
Dim ds As New DataSet
Dim da As OleDb.OleDbDataAdapter
Dim sql As String
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
dbProvider = "PROVIDER=Microsoft.Jet.OLEDB.4.0;"
dbSource = "Data Source = C:\Users\Hasin\Desktop\computing\DATABASE TEST\AddressBook.mdb"
con.ConnectionString = dbProvider & dbSource
con.Open()
sql = "SELECT * FROM tblContacts"
da = New OleDb.OleDbDataAdapter(sql, con)
da.Fill(ds, "AddressBook")
con.Close()
MaxRows = ds.Tables("AddressBook").Rows.Count
inc = -1
End Sub
Thanks in advance:)
Re: VB 2010: Need help with Searching and Pulling out records from a specific row
A little bump as the thread took a while getting approved.
:)