【发布时间】:2023-03-24 07:20:02
【问题描述】:
我正在为一个学校项目开发一个程序,该项目基于 Youtube 上的“如何使用带有 VB6 的 SQL Server(包括选择和插入)”视频。
程序如下所示:
单击单选按钮会启用与其相邻的文本框并禁用其余文本框(大文本框除外。然后在“搜索”按钮内嵌入以下代码:
Dim aConnection As New ADODB.Connection
Dim aRecSet As New ADODB.Recordset
Private Sub cmdSearch_Click()
If txtStuNum.Enabled = True Then
aRecSet.Open "select * from studentTable where studentNumber'" & txtDisplay.Text & "'", aConnection, adOpenKeyset
ElseIf txtName.Enabled = True Then
aRecSet.Open "select * from studentTable where Name'" & txtDisplay.Text & "'", aConnection, adOpenKeyset
ElseIf txtGrade.Enabled = True Then
aRecSet.Open "select * from studentTable where Grade'" & txtDisplay.Text & "'", aConnection, adOpenKeyset
ElseIf txtSection.Enabled = True Then
aRecSet.Open "select * from studentTable where section'" & txtDisplay.Text & "'", aConnection, adOpenKeyset
End If
End Sub
当我按下搜索按钮时,会弹出:
感谢所有回复!谢谢!
【问题讨论】: