2013-03-27 90 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