在作mis系统的时候,遇到一个问题。Private Sub Command1_Click()
Dim txtSql As String
Dim txtMsg As String
Dim mrc As ADODB.RecordsettxtSql = "select * from user where username='" & txtName.Text & "'"
Set mrc = ExcuteSql(txtSql, txtMsg)
If mrc.EOF = False Then /*发生错误的语句*/
If mrc.Fields(1) = Trim(txtPassword.Text) Then
frmMDI.Show
Unload Me
Else
MsgBox "密码不正确,重新输入!", vbOKCancel + vbExclamation, "警告!"
Exit Sub
End If
Else
MsgBox "无此用户"
End IfEnd Sub以上是运行的代码,错误提示:
实时错误'91':
对象变量或with块变量未设置请问怎么解决这个问题?
Dim txtSql As String
Dim txtMsg As String
Dim mrc As ADODB.RecordsettxtSql = "select * from user where username='" & txtName.Text & "'"
Set mrc = ExcuteSql(txtSql, txtMsg)
If mrc.EOF = False Then /*发生错误的语句*/
If mrc.Fields(1) = Trim(txtPassword.Text) Then
frmMDI.Show
Unload Me
Else
MsgBox "密码不正确,重新输入!", vbOKCancel + vbExclamation, "警告!"
Exit Sub
End If
Else
MsgBox "无此用户"
End IfEnd Sub以上是运行的代码,错误提示:
实时错误'91':
对象变量或with块变量未设置请问怎么解决这个问题?
解决方案 »
- 如何在有“年-月”格式的组合框中把月份加一,详见内容。
- MScomm控件发送数据时报错
- 急!!弹出菜单问题:弹出时没问题,但点击时的执行顺序不对,VB3下是没问题的!!(答对100分奉送)
- vb中大家是怎么做界面的美化的?
- 一个关于水晶报表汇总的问题
- 请问如何在vb中使用ssl进行连接和传送数据
- 求助!!!DataGrid如何在运行是刷新数据
- 请问我怎么在程序中导入Excel文件,并对它的单元项进行修改,再另存呢?谢谢!
- 在VB里用 ScriptingContext 写网页程序为什么不好?
- 一个vb+485问题
- 一美女要我给她编一个切比雪夫曲线拟合,三天过了.结果还是不对.急.帮兄弟一把吧?
- 请问大家怎样自定义窗体的颜色,按纽的颜色??(100分,谢谢解答)
set mrc=new adodb.recordset
加在什么地方?
又出现第一个错误了!
dim cnn as new adodb.connection
dim textsql as string
cnn.connectionstring="provider=..............." '連接字串
cnn.open
txtSql = "select * from user where username='" & txtName.Text & "'"
mrc.open textsql,cnn,adOpenStatic, adLockPessimistic
strcon="provider=..............."
cn.open strcon
txtSql = "select * from user where username='" & txtName.Text & "'"
cn.excute txtsql