CASorter
asked on
ODBC error in Windows 7 (Not in XP)
I am getting the following error while try to read a recordset:
"ODBC driver does not support the requested properties."
I am running vb6 code on Windows 7 with SQL 2008.
This code has run fine in XP and SQL 2005 and there are literally 100's of similar statements in the project (many using the same connection) which work just fine. The pertinent lines are:
When the project is opened, the following are declared (the gdb.version is 6.1):
Dim gDB As ADODB.Connection
Dim gDBCmd As New ADODB.Command
Set gDB = New ADODB.Connection
gDB.Open “DSN=<Sql DSN Data Source>;UID=sa;PWD=<Passwo rd>”
Set gDBCmd.ActiveConnection = gDB
This is the procedure where the error occurs:
Dim rsStore As New ADODB.Recordset
gDBCmd.CommandText = “Select <FieldName1> From <TableName> Where <FieldName2> = 1”
Set rsStore = gDBCmd.Execute <-- error occurs
Thanks for any help you can give
"ODBC driver does not support the requested properties."
I am running vb6 code on Windows 7 with SQL 2008.
This code has run fine in XP and SQL 2005 and there are literally 100's of similar statements in the project (many using the same connection) which work just fine. The pertinent lines are:
When the project is opened, the following are declared (the gdb.version is 6.1):
Dim gDB As ADODB.Connection
Dim gDBCmd As New ADODB.Command
Set gDB = New ADODB.Connection
gDB.Open “DSN=<Sql DSN Data Source>;UID=sa;PWD=<Passwo
Set gDBCmd.ActiveConnection = gDB
This is the procedure where the error occurs:
Dim rsStore As New ADODB.Recordset
gDBCmd.CommandText = “Select <FieldName1> From <TableName> Where <FieldName2> = 1”
Set rsStore = gDBCmd.Execute <-- error occurs
Thanks for any help you can give
ASKER
I am running 32 bit win 7 and 32 bit ODBC
Try to replace the Early Binding to Late Binding
Dim gDB As Object 'ADODB.Connection
Dim gDBCmd As Object 'New ADODB.Command
Set gDB = CreateObject("ADODB.Connec tion")
Set gDBCmd = CreateObject("ADODB.Comman d")
Dim gDB As Object 'ADODB.Connection
Dim gDBCmd As Object 'New ADODB.Command
Set gDB = CreateObject("ADODB.Connec
Set gDBCmd = CreateObject("ADODB.Comman
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks,
Any idea why this works? I never used late binding before
Any idea why this works? I never used late binding before
If you are running 64 bit Win 7 you are settin gup a 64 bit ODBC connection and you need it setup in 32 bit mode by running this :
C:\Windows\SysWOW64\odbcad
If it is not an ODBC issue I am not sure.