vb 查询数据库提示“from子句语法错误
PrivateSubForm_Load()Dimrq()AsStringDimnr()AsStringDimSqlAsStringDimMsgTxtAsStringSql...
Private Sub Form_Load()
Dim rq() As String
Dim nr() As String
Dim Sql As String
Dim MsgTxt As String
Sql = "select * from note"
Set Rs = ExecuteSQL(Sql, MsgTxt)
If InStr(MsgTxt, "错误") Then
MsgBox MsgTxt
Exit Sub
End If
ReDim Preserve rq(0)
ReDim Preserve nr(0)
If Rs.RecordCount > 0 Then
For i = 1 To Rs.RecordCount
ReDim Preserve rq(i)
ReDim Preserve nr(i)
rq(i) = Rs.Fields("rq") & ""
nr(i) = Rs.Fields("nr") & ""
List1.AddItem (Rs.Fields("rq") & "")
List2.AddItem (Rs.Fields("nr") & "")
List4.AddItem (Rs.Fields("ID") & "")
List3.AddItem (List3.List(i - 1) & "" & List1.List(i - 1) & " " & List2.List(i - 1))
Rs.MoveNext
Next i
End If
End Sub 展开
Dim rq() As String
Dim nr() As String
Dim Sql As String
Dim MsgTxt As String
Sql = "select * from note"
Set Rs = ExecuteSQL(Sql, MsgTxt)
If InStr(MsgTxt, "错误") Then
MsgBox MsgTxt
Exit Sub
End If
ReDim Preserve rq(0)
ReDim Preserve nr(0)
If Rs.RecordCount > 0 Then
For i = 1 To Rs.RecordCount
ReDim Preserve rq(i)
ReDim Preserve nr(i)
rq(i) = Rs.Fields("rq") & ""
nr(i) = Rs.Fields("nr") & ""
List1.AddItem (Rs.Fields("rq") & "")
List2.AddItem (Rs.Fields("nr") & "")
List4.AddItem (Rs.Fields("ID") & "")
List3.AddItem (List3.List(i - 1) & "" & List1.List(i - 1) & " " & List2.List(i - 1))
Rs.MoveNext
Next i
End If
End Sub 展开
若以下回答无法解决问题,邀请你更新回答
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询