'''Testing DB functionality
Dim inc As Integer
Dim MaxRows As Integer
Dim con As New OleDb.OleDbConnection
Dim ds As New DataSet
Dim data As OleDb.OleDbDataAdapter
Dim sql As String
con.ConnectionString = "PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source = C:\work\EyeBase.mdb"
con.Open()
sql = "SELECT * FROM History"
data = New OleDb.OleDbDataAdapter(sql, con)
data.Fill(ds, "History")
con.Close()
MaxRows = ds.Tables("History").Rows.Count
inc = -1
Private Sub btnNext_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnNext.Click
If inc <> MaxRows - 1 Then
inc = inc + 1
NavigateRecords()
Else
MsgBox("No More Rows")
End If
End Sub
Private Sub btnLast_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLast.Click
If inc <> MaxRows - 1 Then
inc = MaxRows - 1
NavigateRecords()
End If
End Sub
Private Sub btnFirst_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnFirst.Click
If inc <> 0 Then
inc = 0
NavigateRecords()
End If
End Sub
Private Sub btnPrevious_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPrevious.Click
If inc > 0 Then
inc = inc - 1
NavigateRecords()
ElseIf inc = -1 Then
MsgBox("No Records Yet")
ElseIf inc = 0 Then
MsgBox("First Record")
End If
End Sub
Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click
If inc = -1 Then
MsgBox("Can't update yet")
Else
ds.Tables("History").Rows(inc).Item(3) = Chief_ComplaintTextBox.Text
'ds.Tables("AddressBook").Rows(inc).Item(2) = txtLast.Text
'ds.Tables("AddressBook").Rows(inc).Item(3) = txtAddress1.Text
'ds.Tables("AddressBook").Rows(inc).Item(4) = txtAddress2.Text
'ds.Tables("AddressBook").Rows(inc).Item(5) = txtAddress3.Text
'ds.Tables("AddressBook").Rows(inc).Item(6) = txtZIP.Text
'ds.Tables("AddressBook").Rows(inc).Item(7) = txtPhone.Text
'ds.Tables("AddressBook").Rows(inc).Item(8) = txtEmail.Text
'ds.Tables("AddressBook").Rows(inc).Item(9) = txtNotes.Text
data.Update(ds, "History")
MsgBox("Data updated")
End If
End Sub
Private Sub btnCommit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCommit.Click
If inc <> -1 Then
Dim cb As New OleDb.OleDbCommandBuilder(data)
Dim dsNewRow As DataRow
dsNewRow = ds.Tables("History").NewRow()
dsNewRow.Item("Chief Complaint") = Chief_ComplaintTextBox.Text
'dsNewRow.Item("Surname") = txtLast.Text
'dsNewRow.Item("Address1") = txtAddress1.Text
'dsNewRow.Item("Address2") = txtAddress2.Text
'dsNewRow.Item("Address3") = txtAddress3.Text
'dsNewRow.Item("Postcode") = txtZIP.Text
'dsNewRow.Item("Phone") = txtPhone.Text
'dsNewRow.Item("Email") = txtEmail.Text
'dsNewRow.Item("Notes") = txtNotes.Text
ds.Tables("History").Rows.Add(dsNewRow)
data.Update(ds, "History")
MsgBox("New Record added to the Database")
End If
End Sub