Vb6 ADODC Login failed for the user knows in Windows 7

1.1k Views Asked by At

I have a vb6 project with a form with a Apex TruedbGrid 6 Oledb datasource that has as an ADODC (Ado 6.0 sp6) on the same form.

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

In Form_Load :

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

When executes last statement Adodc.Refresh only on Windows 7 (because everything works quietly in Xp) gives me the error:

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

I checked the connection string and it is also right when the program uses the same connection to open a recordset and operates quietly.

The connection is declared in a module.

How do you think I can fix on Windows 7 32 bit?

2

There are 2 best solutions below

0
On

You should add attribute on the string with ; Persist Security Info=true

That happens because on Windows Vista or Windows 7 has a new security fix, that causes error on the connection string.

1
On

There's a bug report that this can happen if you have a password with trailing spaces. Their suggestion is:

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.

If that's not it, you might try rewriting it with a different provider anyway. Or replace the grid. I've had some trouble getting VB6 to behave on Windows 7.