vb6.0连接access数据库的问题,本人菜鸟,求大神
PrivateSubCommand1_Click()DimconnAsNewADODB.ConnectionDimrecoAsNewADODB.Recordsetconn...
Private Sub Command1_Click()
Dim conn As New ADODB.Connection
Dim reco As New ADODB.Recordset
conn.Open "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=F:\VB\VB精简版\数据库\123.mdb"
reco.Open "select new_password from 表1 where new_department =" & Text1.Text
If Recordset.EOF And Recordset.BOF Then
MsgBox "用户不存在"
Else
If Text2.Text = Recordset("new_password").Value Then
MsgBox "登陆成功"
Else: MsgBox "密码错误"
End If
End If
reco.Close
conn.Close
End Sub
求大神,只有这点分了,拜托拜托,困恼2天了,上网找资料也没找到,只能求助各位了,多谢多谢
想做成帐号密码登录的界面,谢谢 展开
Dim conn As New ADODB.Connection
Dim reco As New ADODB.Recordset
conn.Open "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=F:\VB\VB精简版\数据库\123.mdb"
reco.Open "select new_password from 表1 where new_department =" & Text1.Text
If Recordset.EOF And Recordset.BOF Then
MsgBox "用户不存在"
Else
If Text2.Text = Recordset("new_password").Value Then
MsgBox "登陆成功"
Else: MsgBox "密码错误"
End If
End If
reco.Close
conn.Close
End Sub
求大神,只有这点分了,拜托拜托,困恼2天了,上网找资料也没找到,只能求助各位了,多谢多谢
想做成帐号密码登录的界面,谢谢 展开
2个回答
展开全部
未测试,但修改一下
Private Sub Command1_Click()
Dim conn As New ADODB.Connection
Dim reco As New ADODB.Recordset
conn.Open "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=F:\VB\VB精简版\数据库\123.mdb"
set reco= conn.Execute( "select new_password from 表1 where new_department ='" & Text1.Text & "'")
If reco.EOF And reco.BOF Then
MsgBox "用户不存在"
Else
If Text2.Text = Reco("new_password").Value &"" Then
MsgBox "登陆成功"
Else: MsgBox "密码错误"
End If
End If
reco.Close
conn.Close
End Sub
Private Sub Command1_Click()
Dim conn As New ADODB.Connection
Dim reco As New ADODB.Recordset
conn.Open "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=F:\VB\VB精简版\数据库\123.mdb"
set reco= conn.Execute( "select new_password from 表1 where new_department ='" & Text1.Text & "'")
If reco.EOF And reco.BOF Then
MsgBox "用户不存在"
Else
If Text2.Text = Reco("new_password").Value &"" Then
MsgBox "登陆成功"
Else: MsgBox "密码错误"
End If
End If
reco.Close
conn.Close
End Sub
追问
55,咋回事啊,能教教我不,我是出了啥问题啊
追答
把我的复制上去,测试一下,不行吗?
这段代码能执行前题:
1、 F:\VB\VB精简版\数据库\123.mdb 文件存在
2、VB工程中引用 Microsot Activex Data 2.x Library
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询