我正在尝试检查数据库中是否存在在文本框中输入的id号的数据。如果是这样,我希望我的程序去另一个windowsform。如果没有,它应该返回错误消息。这是我的代码,但它不起作用。我将不胜感激任何帮助!
AcademicAssessmentCommand.CommandText = "Select StudentID from DarsReports WHERE StudentID = " & StudentIDInMainTextBox.Text & ""
Dim AATDataReader As OleDbDataReader = AcademicAssessmentCommand.ExecuteReader()
If AATDataReader.Read() Then
Dim searchForm As New SearchForm
searchForm.ShowDialog()
Else
MsgBox("The Record does not exist in the database.")
End If