Hi, I'm new to the forum and I was wondering if anyone would know how to display data from the tables of a MS Access database on labels on a form.
The code underneath is my code for saving inputted data from textboxes.
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click
objDA = New OleDbDataAdapter("SELECT * FROM CDetails", "Provider=Microsoft.Jet.OLEDB.4.0;Password=;" & "User ID=Admin;Data Source =" & Application.StartupPath & "\CustomerDetails.mdb")
objDS = New Data.DataSet()
objCB = New OleDbCommandBuilder(objDA)
objDA.Fill(objDS, "CDetails")
Dim objRow As Data.DataRow
With objDS.Tables(0)
objRow = .NewRow
objRow("FirstName") = txtFirst.Text = FirstName
objRow("Surname") = txtSur.Text
objRow("Address") = txtAddress.Text
objRow("AreaCode") = txtArea.Text
objRow("State") = txtState.Text
objRow("Country") = txtCountry.Text
objRow("HomePh") = txtHome.Text
objRow("DOB") = txtDob.Text
.Rows.Add(objRow)
End With
'Updates the database with the row
objDA.Update(objDS, "CDetails")
MsgBox("Details Saved")
End Sub
I would like to show these saved details onto another form. Is there a way to select rows and cells in the database and fetch the data in them to display them onto labels?
Thanks alot!