ado读取数据,问题应该不难。代码贴出来了,请大家看看那里错了

gao gao 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
Private Sub ImgIn_Click()
On Error GoTo eRRorHandle
Dim GetRight As New ADODB.Recordset
User_Name = UserName.Text
User_Pswd = Password.Text
Dim strsql As String
strsql = "select userid from app.users where username = '" & User_Name & "' and userpassword = '" & User_Pswd & "'"
Call Dbconnection
Set GetRight = New Recordset '●●注意这里出错了。
With GetRight
Set .ActiveConnection = cnMain
.Open strsql, , adOpenDynamic, adLockOptimistic
End With
If Not GetRight.EOF() Then
If InStr(1, GetRight.Fields("Privilege").Value, RightAll) > 0 Then
Unload FirstForm
frm1.Show
Else
MsgBox "无此权限!", vbCritical, "错误提示"
End If
Else
MsgBox "用户名称或口令错!", vbCritical, "错误提示"
End If
Exit Sub
eRRorHandle:
MsgBox "与数据库的连接失败!", vbCritical, "错误提示"
End Sub


Public Sub Dbconnection()
szConn = "Provider=MSDAORA.1;Password=123123;User ID=app;Data Source=app;Persist Security Info=True"
Set cnMain = New Connection
cnMain.Open szConn
End Sub
...全文
评论 2
收藏 已收藏
分享
返回顶部