Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
ODBC connection
Message
De
22/11/2007 07:05:19
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
ODBC connection
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Database:
MySQL
Divers
Thread ID:
01270657
Message ID:
01270657
Vues:
49
Hello Everybody,

I am trying to retrieve data from MySQL database. I was using the following method till now.
1. Create a user DSN ('mySqlODBC')
2. lha = sqlConnect('mySqlODBC')
3. lcQry = "Select u.userid Id, concat(u.firstname, ' ', u.lastname) Name, from loans as l "
4. lnResult = SQLEXEC(lha, lcQry, 'cmpData')
5. SELECT cmpData

I was trying to get rid of the process to create user DSN, hence tried the following
1. mySQLCn = "driver=MySQL ODBC 3.51 Driver;server=192.168.2.2;uid=####;pwd=##"
2. lha = SQLSTRINGCONNECT(mySQLCn,.T.)
3. lcQry = "Select u.userid Id, concat(u.firstname, ' ', u.lastname) Name, from loans as l "
4. lnResult = SQLEXEC(lha, lcQry, 'cmpData')
5. SELECT cmpData
However now I get the error "cursor cmpData not found". It looks like that SQLEXEC is failing.

Is there anything wrong I am doing ? Kindly suggest.

Many thanks in advance,
Abhi
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform