当前位置: 代码迷 >> Sql Server >> 出现对象变量或with快变量未设置这样应该如何避免啊
  详细解决方案

出现对象变量或with快变量未设置这样应该如何避免啊

热度:173   发布时间:2016-04-27 19:30:21.0
出现对象变量或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.
  相关解决方案