誰かがこれを手伝ってくれることを願っています。私はSQLが初めてで、混乱します。入力ボックスを介して mySQL テーブルで特定の/一致するデータを検索したい.
ここに私のコードがあります..
Dim rs As New ADODB.Recordset
myConn
Dim holdstr As String
holdstr = InputBox("Enter Number")
rs.Open "SELECT * FROM lemployees ", conn
Do Until rs.EOF
If holdstr = "" Then
conn.Close
Exit Sub
End If
If holdstr = rs!ENumber Then
MsgBox "Record found!", vbInformation, "Message"
UserForm2.lblnum.Caption = rs!ENumber
UserForm2.TextBox2.Text = rs!ELName
UserForm2.TextBox3.Text = rs!EFName
UserForm2.TextBox4.Text = rs!EMName
UserForm2.boxPos = rs!EDepartment
UserForm2.TextBox6.Text = rs!EAge
UserForm2.TextBox7.Text = rs!EHourlyPaid
UserForm2.TextBox8.Text = rs!ECitizen
conn.Close
Exit Sub
Else
MsgBox "Record not found", vbInformation, "Message"
Exit Sub
End If
Loop
ありがとう!