All i want is every time i finish the registration and I click ADD button I want my ID increase one . Like 1 , 2 , 3, ... Here's my code
Try
cn = New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source= " & Application.StartupPath & "\HMSdb.accdb")
cn.Open()
cmd = New OleDbCommand("select * from PatientRegistration ", cn)
Dim dr As OleDbDataReader = cmd.ExecuteReader
If dr.Read Then
txtPatientID.Text = dr.Item(0) + 1
Else
txtPatientID.Text = "1"
End If
Catch ex As Exception
MsgBox(ex.Message)
End Try
Try
cn = New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source= " & Application.StartupPath & "\HMSdb.accdb")
cn.Open()
cmd = New OleDbCommand("select * from PatientRegistration ", cn)
Dim dr As OleDbDataReader = cmd.ExecuteReader
If dr.Read Then
txtPatientID.Text = dr.Item(0) + 1
Else
txtPatientID.Text = "1"
End If
Catch ex As Exception
MsgBox(ex.Message)
End Try