vb编程,用到ADO语句,显示from子句语法错误
PrivateSubCommand5_Click()rs3.CursorLocation=adUseClientDimstrtempAsStringstrtemp="se...
Private Sub Command5_Click()
rs3.CursorLocation = adUseClient
Dim strtemp As String
strtemp = "select * from order where cusnam='" & Text1(0).Text & "'"
rs3.Open strtemp, conn, adOpenDynamic, adLockOptimistic
For i = 1 To rs2.RecordCount
List1.AddItem rs2("number")
rs2.MoveNext
Next i
rs3.Close
Set rs3 = Nothing
Command1.Enabled = False
Command2.Enabled = False
Command4.Enabled = False
Command3.Enabled = True
For a = 0 To 8
Text1(a).Enabled = False
Next a
End Sub
请问怎么办 展开
rs3.CursorLocation = adUseClient
Dim strtemp As String
strtemp = "select * from order where cusnam='" & Text1(0).Text & "'"
rs3.Open strtemp, conn, adOpenDynamic, adLockOptimistic
For i = 1 To rs2.RecordCount
List1.AddItem rs2("number")
rs2.MoveNext
Next i
rs3.Close
Set rs3 = Nothing
Command1.Enabled = False
Command2.Enabled = False
Command4.Enabled = False
Command3.Enabled = True
For a = 0 To 8
Text1(a).Enabled = False
Next a
End Sub
请问怎么办 展开
展开全部
order是SQL的保留字,说得通俗一点就是order是SQL本身的命令词(其他的像select、from、where等等也是),所以一般是不能用作表名或字段名的,因为会造成系统产生歧义(就是说电脑分不清是表名还是命令词了)。
如果一定要用也不是不可以,但是必须加上方括号,即:
strtemp = "select * from [order] where cusnam='" & Text1(0).Text & "'"
此外,要把所有rs2改为rs3,这么低级的错误你也会犯啊?
如果一定要用也不是不可以,但是必须加上方括号,即:
strtemp = "select * from [order] where cusnam='" & Text1(0).Text & "'"
此外,要把所有rs2改为rs3,这么低级的错误你也会犯啊?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询