Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL Connection String in a Connection Object
Message
De
05/11/1998 14:11:51
Robert Byrd
National Association of Homebuilders
Washington, District de Colombia, États-Unis
 
 
À
05/11/1998 13:46:00
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00154910
Message ID:
00154957
Vues:
21
Thanks for the info!

I will just use =SQLPREPARE(g_oApp.r_nConVar,"....,""). It seems to work ust fine.

Your input was invaluable.


>Hiya Bob ---
>
>Your problem is that you are using the object "l_oConnection" where the SQLPREPARE function is expecting a numeric connection number. The CREATEOBJECT function is creating an instance of cusConObj, *not* returning the return value from the Init as you may expect. Try creating a custom property in cusconobj named connnumber and populating it with the connection number in Init. Then after creating l_oConnection, call SQLPREPARE with l_oConnection.connnumber.
>
>
>
>>I have created a connection object cusConnObj whose INIT code is...
>>
>>
>>CREATE DATA worktbls\dataconn
>>
>>CREATE CONNECTION nConVar CONNSTRING &p_cConnString
>>g_oApp.r_nConVar = SQLCONNECT('nConVar')
>>
>>RETURN g_oApp.r_nConVar
>>
>>
>>...where r_cVonVar is a property in my application object and p_cConnString is a valid SQL Server connection string.
>>
>>I call this from a reporting procedure as follows...
>>
>>
>>SET CLASSLIB TO LM2CUSTOM ADDITIVE
>>l_oConnection=CREATEOBJECT("cusConnObj")
>>
>>=SQLPREPARE(l_oConnection,"Select l.li_name, g.gn_desc, count(nl.na_liid) cnt from name n, namelist nl, list l, gender g where n.na_id = nl.na_id and nl.na_liid *= l.li_id and n.na_gender *= g.gn_id GROUP BY l.li_name, g.gn_desc","_temp")
>>
>>
>>... which results in an error : "Function argument value, type or count is invalid."
>>
>>What's wrong with this picture?
>>
>>Bob
Database Development Team
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform