2013-03-27 94 views
0

我有一个表单与一个Apex TruedbGrid 6 Oledb数据源,具有作为一个ADODC(Ado 6.0 sp6)在同一表单上的vb6项目。Vb6 ADODC登录失败,用户知道在Windows 7中

cn.ConnectionString = "Provider=SQLNCLI.1;Data Source=pc-musica;Initial Catalog=QdE;User ID=sa;Password=*******"

在的Form_Load:

Adodc.ConnectionString = cn.ConnectionString 
Adodc.RecordSource = "Select Code, Description from Cantine" 
Adodc.Refresh 

当只有在Windows 7上执行的最后一条语句Adodc.Refresh(因为一切正常,悄悄地在XP)给我的错误:

Login failed for the user, type: -2147217843 Automation Error.

我检查了连接字符串,当程序使用相同的连接时也是正确的打开一个记录集并安静地运行。

连接在模块中声明。

你认为我可以修复Windows 7 32位?

回答

0

有一个bug report,这可能发生,如果你有密码尾随空格。他们的建议是:

To work around this problem, use the OLE DB Provider for ODBC Driver instead of the OLE DB Provider for SQL Server, or do not create passwords with trailing spaces.

如果不是这样,你可以尝试用不同的提供者重写它。或者更换网格。我在VB6上运行Windows 7时遇到了一些麻烦。

+0

在我的密码中没有尾随空格,即使OleDb Provider不起作用 – user2216394 2013-03-28 09:33:23

1

您应该在字符串中添加属性; Persist Security Info=true

发生这种情况是因为在Windows Vista或Windows 7上有一个新的安全修复程序,导致连接字符串出错。

+0

它适用于我 – ehh 2018-01-10 06:10:32