ado读取数据,问题应该不难。代码贴出来了,请大家看看那里错了
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
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
...全文
相关推荐
ADO.NET连接环境中访问数据_执行命令读取数据
ADO.NET连接环境中访问数据_执行命令读取数据 ppt
Win10ADO组件安装包
我们Win10 64位操作系统中,有通过ADO方式操作数据库会失败,无法读取数据,可能是我们缺少组件,下载后按照解压里的文件说明操作
ado.net读取数据的两种方法
ado.net读取数据的两种方法,精心整理,适合编程初学者
Delphi用ADO把Excel内容读取至表格
delphi2007,无第三方控件,使用用ADO控件把Excel内容读取至DbGrid表格中。简单好用,一看就会。
ADO对象操作ACCESS代码
ADO对象操作ACCESS代码 ADO对象操作ACCESS代码


数据库(包含打印,安装,报表)
