我希望每次完成注册后,文本框中的ID增加1,然后单击ADD按钮。
这是我的代码
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