使用密码将字符串连接到MS Access [英] Connectstring to MS Access with password

查看:78
本文介绍了使用密码将字符串连接到MS Access的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的档案:C:\ data.mdb

密码:ALT + 1029(我签名特殊字符)



 公共  Sub  connect()
Dim cn As ADODB.Connection
设置 cn = ADODB.Connection
使用 cn
.ConnectionString = Provider = Microsoft.Jet.OLEDB.4.0; Data Source = C:\ Data.mdb; Jet OLEDB:Database Password = ALT + 1029;
.CursorLocation = adUseClient
。打开
结束 使用
结束 Sub





但连接失败。 worng pass

任何人帮助我。谢谢

解决方案

尝试使用:

 .ConnectionString =   Provider = Microsoft.Jet.OLEDB.4.0; Data Source = C:\ Data.mdb; Jet OLEDB:Database Password =♣; 

Alt + 1029未被''转换'',应输入为''♣''。



访问连接字符串 [ ^ ]包含注释

一些密码长度超过14个字符的报告。还有一些角色可能会造成麻烦。如果您遇到问题,请尝试将密码更改为包含普通字符的短密码。

因此,使用此特殊字符可能无效,测试您可以执行建议并尝试使用简单密码。


我觉得这对你有帮助。 。 。





  //  < span class =code-comment> ---- For Location ----------------------------------- -------------------------------------------------- -   
public static string strFile = @ C:\db_dataBaseName.accdb;
// -------------------- -------------------------------------------------- ----------------------------------
public static string strPass = 密码;
public static string connstring = Provider = Microsoft.ACE.OLEDB.12.0; Data Source = + strFile + ; Jet OLEDB:数据库密码= + strPass + ; Persist Security Info = False;;


仍然出错。我无法在VBA访问中分配符号



http://nw4.upanh.com/b2.s36.d2/9cca35bc4004d2dc57e7d01a4fbd4a77_55253104.faststoneeditor.bmp [ ^ ]



这是一个项目VB6 + Data ms access 2003使用密码符号:



http://www.mediafire.com/download.php?q627s0645dyvs4j [ ^ ]



我想设置密码并连接到这个文件,就像这样项目

My file : C:\Data.mdb
Password : ALT+1029 (me asign special character)

Public Sub connect()
Dim cn As ADODB.Connection
Set cn = New ADODB.Connection
With cn
    .ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Data.mdb;Jet OLEDB:Database Password=ALT+1029;"
    .CursorLocation = adUseClient
    .Open
End With
End Sub



But connect fail. worng pass
Any one help me. thanks

解决方案

Try it with:

.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Data.mdb;Jet OLEDB:Database Password=♣;"

Alt+1029 is not ''converted'' and should be entered as ''♣''.

But Connection strings for Access[^] contains the comment

Some reports of problems with password longer than 14 characters. Also that some characters might cause trouble. If you are having problems, try change password to a short one with normal characters.

So using this special character may not work, to test you can do what remark suggest and try a simple password.


I Thing this will help to you . . .


//---- For Location --------------------------------------------------------------------------------------
public static string strFile = @"C:\db_dataBaseName.accdb";
//--------------------------------------------------------------------------------------------------------
public static string strPass = "password";
public static string connstring = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + strFile + ";Jet OLEDB:Database Password=" + strPass + ";Persist Security Info=False;";


Still error . I can not assign symbol in VBA Access

http://nw4.upanh.com/b2.s36.d2/9cca35bc4004d2dc57e7d01a4fbd4a77_55253104.faststoneeditor.bmp[^]

This is a project VB6 + Data ms access 2003 using password symbol :

http://www.mediafire.com/download.php?q627s0645dyvs4j[^]

I want to set password and connect to this file like this project.


这篇关于使用密码将字符串连接到MS Access的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆