vb中text显示问题
有七个text同属一个组,有一个命令按钮,点击按钮在text中显示内容,代码如下,为何有的text中不显示PrivateSubCommand1_Click()OnErro...
有七个text同属一个组,有一个命令按钮,点击按钮在text中显示内容,代码如下,为何有的text中不显示
Private Sub Command1_Click()
On Error Resume Next
If Text1(0).text = "" Then
MsgBox "请输入学号"
Else
Set cn = New ADODB.Connection
Set rs = New ADODB.Recordset
ConStr = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=library;Data Source=zlz"
cn.Open ConStr
cn.CursorLocation = adUseServer
rs.Open "Select * from reader where 学号='" & Text1(0).text & "'", cn, adOpenKeyset, adLockPessimistic
Text1(1).text = rs.Fields("姓名").Value
Text1(2).text = rs.Fields("性别").Value
Text1(3).text = rs.Fields("年龄").Value
Text1(4).text = rs.Fields("学院").Vlaue
Text1(5).text = rs.Fields("专业").Vlaue
Text1(6).text = rs.Fields("班级").Vlaue
End If
End Sub 展开
Private Sub Command1_Click()
On Error Resume Next
If Text1(0).text = "" Then
MsgBox "请输入学号"
Else
Set cn = New ADODB.Connection
Set rs = New ADODB.Recordset
ConStr = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=library;Data Source=zlz"
cn.Open ConStr
cn.CursorLocation = adUseServer
rs.Open "Select * from reader where 学号='" & Text1(0).text & "'", cn, adOpenKeyset, adLockPessimistic
Text1(1).text = rs.Fields("姓名").Value
Text1(2).text = rs.Fields("性别").Value
Text1(3).text = rs.Fields("年龄").Value
Text1(4).text = rs.Fields("学院").Vlaue
Text1(5).text = rs.Fields("专业").Vlaue
Text1(6).text = rs.Fields("班级").Vlaue
End If
End Sub 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询