日期:2014-05-18  浏览次数:20575 次

出现对象变量或with快变量未设置这样应该如何处理啊?急
Dim TxtSql As String
Dim Mrc As ADODB.Recordset
Dim MsgText As String
TxtSql = "select * from Tuser where Tname='" & cboUser.Text & "'"
Set Mrc = ExecuteSQL(TxtSql, MsgText)
If Mrc.EOF = True Then
MsgBox " 没有该用户,请重新输入!", vbOKOnly + vbExclamation, "警告"
End If

运行时出现“出现对象变量或with快变量未设置”
请大哥们指教~

------解决方案--------------------
Set Mrc = ExecuteSQL(TxtSql, MsgText) 

这个看来起来有问题?是VB吗?
------解决方案--------------------
Use Debug and stop at the place of "Set Mrc = ExecuteSQL(TxtSql, MsgText)", copy the content of TxtSql and run it
in the management studio to see if it's working or not. From there you can see more clearly what is going on about the query.