请高手帮帮忙指点啊!我是新手:“实时错误‘13‘ 类型不匹配”
Private Sub Command1_Click()Dim conn As ADODB.Connection
Dim rs As ADODB.Recordset
Dim str As String
Set conn = New ADODB.Connection
Set rs = New ADODB.Recordset
'Set str = "Microsoft.Jet.OLEDB.4.0;Data Source=j:\vb+access\xuexi.mdb"
conn.Provider = "Microsoft.Jet.OLEDB.4.0"
conn.ConnectionString = "Data Source=" & App.Path & "\data.mdb" & " ;Jet OLEDB:Database password= coucongzi"
conn.Open
rs.Open "select * from yhinfo where userid =" + Int(Text5.Text) + " and username=" & Chr(Text1.Text) & "", conn, adOpenDynamic, adLockPessimistic
If rs.EOF = False Then
MsgBox "用户编码或用户名已经存在,请检查后重新输入!", 16, "错误!"
rs.Close
Else
end if
...
...
end sub
上面的代码执行之后
总是提示“实时错误‘13‘ 类型不匹配”
调试的时候,在
rs.Open "select * from yhinfo where userid =" + Int(Text5.Text) + " and username=" & Chr(Text1.Text) & "", conn, adOpenDynamic, adLockPessimistic
这一行代码中变黄色,个人感觉很有可能问题出在了username=" & Chr(Text1.Text) & "",这段
我的username字段在ACCESS的字段类型是选择文本(不知道是不是这里错了),记录都是中文名字,如“张三”
请哪位高手帮忙指点一下要怎么改啊,小弟是新手,跪谢了!