Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Cursor Adapter and Shared Connection
Message
 
 
To
21/10/2003 18:50:38
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00840664
Message ID:
00840987
Views:
17
>Hi Mark
>
>I have the same problem, I´m using an ODBC connection. I´ve created my connection programmatically as you suggested, but it doesn´t work.
>
>1. Where can I put the connection string code?
> In the beforeopentables dataenvironment event....

For example, let's say I have my connection handle stored in goApp.nConHandle, in the CA, you would set the DataSource property to =goApp.nConHandle [you need the leading equal sign].

>2. Use that connection handle as the DataSource in your CAs? where?
> I tried using a variable, but when I run my form, I recieve a syntax
> error and I can´t open my form.

See #1 above. Store that reference in the DataSource property of the CABase class in the ClassLib created by my builder. That class is also where you would set the DataSourceType property to ODBC.

>3. If I want to use ADO, how can I do to create parameters like in the ODBC
> connection?

Parameters in a SELECT ... WHERE clause? You would specify a SELECT SQL just like in ODBC. Just make sure the parameters exist and have valid values before the CursorFill fires. The way I handle this is the parameters are references to object properties like goApp.nCustomerID so the WHERE clause looks like WHERE CustomerID = ?goApp.nCustomerID

You should also create the ADO object programmatically before running any form. In the CABase class in the VCX, you would set the oADO_Conn property to the property or variable that is holding this object reference. Unlike the DataSource property, do not precede the value of this property with an equal sign. At runtime, the code in the CABase class will do an EVALUATE() on that properties value which will convert it to an object. It will then put this object reference in the DataSource property as well as populate the oADO_Command and oADO_RS properties.
Mark McCasland
Midlothian, TX USA
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform