VB加access制作查询功能
要密码登陆,要求源码conn.ConnectionString="Provider=Microsoft.Jet.OLEDB.4.0;DataSource="&App.Pa...
要密码登陆,要求源码
conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\worksystem.mdb;"
怎么加入密码.access密码为abcd 展开
conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\worksystem.mdb;"
怎么加入密码.access密码为abcd 展开
展开全部
若要设置密码须加上Jet OLEDB:Database Password=abcd;Persist Security Info=True就可以了。如下:
【登陆完整源码】 :
Private Sub cmdlogin_Click()
If txtuser = "" Then
MsgBox "Please fill in User Name.", vbInformation + vbOKOnly, "Information"
txtuser.SetFocus
Exit Sub
End If
If txtpassword = "" Then
MsgBox "Please fill in Password.", vbInformation + vbOKOnly, "Information"
txtpassword.SetFocus
Exit Sub
End If
Dim SQL As String
Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Jet OLEDB:Database Password=abcd;Persist Security Info=True;Data Source=" & App.Path & "\数据库名称.mdb"
Adodc1.CursorLocation = adUseClient
Adodc1.CommandType = adCmdText
SQL = "select * from 资料表名称 where UserName='" & Trim$(txtuser.Text) & "'And Password='" & Trim$(txtpassword.Text) & "'"
Adodc1.RecordSource = SQL
Adodc1.Refresh
If Adodc1.Recordset.RecordCount <> 0 Then
Unload Me
Form2.Show
Else
MsgBox "Invalid Username or password!", vbExclamation + vbOKOnly, "Error"
txtuser.SetFocus
End If
End Sub
--------------------
【查询功能源码】
ADODC1.ConnectionString = "provider=Microsoft.jet.OLEDB.4.0;Persist security info= False; Data source=" & App.Path & "\数据库名称.mdb"
ADODC1.CursorLocation = adUseClient
ADODC1.CommandType = adCmdText
ADODC1.RecordSource = “select * from 资料表名称 where 姓名 = '" & Text1.Text & "'"
ADODC1.Refresh
【登陆完整源码】 :
Private Sub cmdlogin_Click()
If txtuser = "" Then
MsgBox "Please fill in User Name.", vbInformation + vbOKOnly, "Information"
txtuser.SetFocus
Exit Sub
End If
If txtpassword = "" Then
MsgBox "Please fill in Password.", vbInformation + vbOKOnly, "Information"
txtpassword.SetFocus
Exit Sub
End If
Dim SQL As String
Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Jet OLEDB:Database Password=abcd;Persist Security Info=True;Data Source=" & App.Path & "\数据库名称.mdb"
Adodc1.CursorLocation = adUseClient
Adodc1.CommandType = adCmdText
SQL = "select * from 资料表名称 where UserName='" & Trim$(txtuser.Text) & "'And Password='" & Trim$(txtpassword.Text) & "'"
Adodc1.RecordSource = SQL
Adodc1.Refresh
If Adodc1.Recordset.RecordCount <> 0 Then
Unload Me
Form2.Show
Else
MsgBox "Invalid Username or password!", vbExclamation + vbOKOnly, "Error"
txtuser.SetFocus
End If
End Sub
--------------------
【查询功能源码】
ADODC1.ConnectionString = "provider=Microsoft.jet.OLEDB.4.0;Persist security info= False; Data source=" & App.Path & "\数据库名称.mdb"
ADODC1.CursorLocation = adUseClient
ADODC1.CommandType = adCmdText
ADODC1.RecordSource = “select * from 资料表名称 where 姓名 = '" & Text1.Text & "'"
ADODC1.Refresh
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
AiPPT
2024-09-19 广告
2024-09-19 广告
随着AI技术的飞速发展,如今市面上涌现了许多实用易操作的AI生成工具1、简介:AiPPT: 这款AI工具智能理解用户输入的主题,提供“AI智能生成”和“导入本地大纲”的选项,生成的PPT内容丰富多样,可自由编辑和添加元素,图表类型包括柱状图...
点击进入详情页
本回答由AiPPT提供
展开全部
&"Jet OLEDB:Database Password=abcd;"
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询