Reputation: 1
I am developing a program for a school project that is kind of based on the "How to Use SQL Server with VB6 (inc. select & insert)" video on Youtube.
The program looks like this:
Clicking a radio button enables the textbox adjacent to it and disables the rest (except for the big textbox. Then inside the Search button, the following code is embedded:
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
And when I press the search button, this pops up:
All responses are appreciated! Thanks!
Upvotes: 0
Views: 10148