Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQLConnect() not working from COM object
Message
De
28/08/2005 21:08:34
 
 
À
28/08/2005 20:51:03
Alan Harris-Reid
Baseline Data Services
Devon, Royaume Uni
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Versions des environnements
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Database:
MS SQL Server
Divers
Thread ID:
01044667
Message ID:
01044670
Vues:
14
>I have created a MTDLL COM object which I am calling from an ASP page using the code
>Set oTest=Server.CreateObject("comtest.MyClass")
>oQuote = oTest.MyMethod(params list)
>
>When I call the method from within the VFP development environment everything works fine, and I get the expected results, but when I load the ASP page in a browser, I get an error due to a failed SQLCONNECT command...
>lnHandle = SQLCONNECT('ODBC Database name','Username','Password') (returns -1 to denote failed connection).
>
>AERROR() returns the following values
>[1]1526
>[2]Connectivity error: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
>[3][Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
>[4]IM002
>[5]0
>[6]1
>[7].NULL.
>
>I cannot work-out why SQL finds the datasource when called from VFP, but cannot do so when called from the ASP page. Has anyone any ideas how I can solve this problem so that the COM object can run correctly from both environments?
>
>Any help would be appreciated.
>
>Alan



Not sure why it works in one mode and not the other but it could be you created a User DSN and the COM version does not run under your username but the system account.

Why not get rid of the DSN altogether and go DSNLess with SQLSTRINGCONNECT() instead?

See:
http://fox.wikis.com/wc.dll?Wiki~VFPCommandSQLStringConnect


Alex Feldstein, MCP, Microsoft MVP
VFP Tips: English - Spanish
Website - Blog - Photo Gallery


"Once again, we come to the Holiday Season, a deeply religious time that each of us observes, in his own way, by going to the mall of his choice." -- Dave Barry
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform