窗体上有3个text 的控件数组,输入后错误如下:[SQL SERVER]第一行=附近有错误
对象Refresh 的方法IAdodc 失败源代码如下:
Private Sub selcmd1_Click()condstr = "" '条件表达式初始值为空,以下根据用户的输入构造该条件表达式
If Trim(Text1(0).Text) <> "" Then
 If condstr = "" Then
    condstr = "姓名='" + Trim(Text1(0).Text) + "'"
Else
  condstr = condstr + "and 姓名='" + Trim(Text1(0).Text) + "'"
End If
End If
'If Trim(Text1(1).Text) <> "" Then
 'If condstr = "" Then
 '   condstr = "学号='" + Trim(Text1(1).Text) + "'"
'Else
'  condstr = condstr + "and 学号='" + Trim(Text1(1).Text) + "'"
'End If
'End If
'If Trim(Text1(2).Text) <> "" Then
' If condstr = "" Then
  '  condstr = "课程='" + Trim(Text1(2).Text) + "'"
'Else
''  condstr = condstr + "and 课程='" + Trim(Text1(2).Text) + "'"
'End If
'End If
If condstr <> "" Then '有条件查找
 Adodc1.RecordSource = "select *from bukao where" + condstr
 Adodc1.Refresh
 Else
 Adodc1.RecordSource = "select *from bukao"
 Adodc1.Refresh
End If
recs = Adodc1.Recordset.RecordCount
If recs = 0 Then
  MsgBox "没有任何条件的记录", vbOKOnly, "信息提示"
End If
Call encomm
End Sub