我正在尝试删除在文本框中输入的人的记录。这是我的代码,我不知道接下来该做什么,因为我的代码无效。
AcademicAssessmentConnection = New OleDbConnection("provider=microsoft.ace.oledb.12.0;data source=" & Application.StartupPath & "\AdvisorAssessmentTool.accdb")
AcademicAssessmentConnection.Open()
AcademicAssessmentCommand = New OleDbCommand()
AcademicAssessmentCommand.Connection = AcademicAssessmentConnection
AcademicAssessmentCommand.CommandText = "DELETE (*) from Students where StudentID = @lookup"
AcademicAssessmentCommand.ExecuteNonQuery()
MsgBox("Successfully Deleted")
AcademicAssessmentConnection.Close()
答案 0 :(得分:1)
您需要向Command对象添加一个包含@lookup值的参数。
AcademicAssessmentCommand.Parameters.AddWithValue("@lookup", lookup);