When i run the program i got the patient id = 1 then register again then patient id = 2 but when i register again it remain 2 . what is the problem with my code ?
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
Comment