Private Sub Command1_Click()
If Len(Text1.Text) > 0 Then
SqlStudent.CommandType = adCmdText '这句红色的代码有报错
SqlStudent.RecordSource = "select * from Student where SNum='" & Trim(Text1.Text) & " '"
SqlStudent.Refresh
Text2.Text = SqlStudent.Recordset.Fields("StuNam").Value
Text4.Text = SqlStudent.Recordset.Fields("StuSpe").Value
'Text4.Text = sqlStudent.Recordset.Fields("StuBir").Value
Text3.Text = SqlStudent.Recordset.Fields("Sdept").Value
Else
MsgBox ("请输入要查找的学号!")
End If
End Sub
实时错误424
要求对象?
什么原因呢?
上面的代码主要是要实现学生信息个查询功能.........
If Len(Text1.Text) > 0 Then
SqlStudent.CommandType = adCmdText '这句红色的代码有报错
SqlStudent.RecordSource = "select * from Student where SNum='" & Trim(Text1.Text) & " '"
SqlStudent.Refresh
Text2.Text = SqlStudent.Recordset.Fields("StuNam").Value
Text4.Text = SqlStudent.Recordset.Fields("StuSpe").Value
'Text4.Text = sqlStudent.Recordset.Fields("StuBir").Value
Text3.Text = SqlStudent.Recordset.Fields("Sdept").Value
Else
MsgBox ("请输入要查找的学号!")
End If
End Sub
实时错误424
要求对象?
什么原因呢?
上面的代码主要是要实现学生信息个查询功能.........
你没有在窗体中插入名为SqlStudent的ADO控件才会这样