Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

vbs connection to Micros database

Status
Not open for further replies.

raphael75

Programmer
Nov 15, 2012
67
US
I have to write another script to connect command-line vbscript to Micros, which uses SQL Anywhere 11. When I try to make the connection I get this error:


Code:
The specified dsn contains an architecture mismatch between the driver and application
code 80004005

and the connection:

Code:
Set Connection = CreateObject("ADODB.Connection")
strdsn = "DSN=micros;UID=********;PWD=********;"
connection.open strdsn

Apparently that error has something to do with 32- vs. 64-bit drivers, but I don't know how to fix it. Please help, thanks!
 
Code:
'SQL connection variables
Dim con_Micros As ADODB.Connection
Dim rs_PeriodTrkTtls As ADODB.Recordset
Dim rs_PeriodOTTtls As ADODB.Recordset
Dim rs_FixedPeriodSeqs As ADODB.Recordset
Dim rs_LaborTotals As ADODB.Recordset
    
Set con_Micros = New ADODB.Connection
Let con_Micros.ConnectionString = "DSN=micros;UID=custom;PWD=custom"
con_Micros.Open

Using this in an excel spreadsheet; works just fine. Did you register the drivers yourself on the machine you're running this on, or are you running it directly on Micros?

Don't think this is valid as of 5.2 in that the actual setup portion where you put in the server information has changed, but it gets you far enough to properly register the driver and start setting up the ODBC connection.
 
The .vbs script I'm trying to get working needs to run on the same computer where Micros is installed.

I went to the c:\windows\syswow64 folder and opened the odbcad32.exe file in there. I created a new User DSN called "micros_2" and copied all the settings the "official" Micros System DSN uses. I tested the connection and it was successful. I tried this:

Code:
Set Connection = CreateObject("ADODB.Connection")
strdsn = "DSN=[COLOR=#CC0000]micros_2[/color];UID=custom;PWD=custom"
connection.open strdsn

but I got the same vbs error.

 
I would suggest you used a compiled version of VB though because then you can just set the architecture target. Visual Studio Express is free.
 
I think the best plan will be to use dbisql and parse the results. I have tested this and it works. Thanks so much for all the suggestions.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top