Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Just a tip I wanted to share with you
Message
From
15/09/2002 21:29:13
 
 
To
15/09/2002 09:56:35
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Miscellaneous
Thread ID:
00700597
Message ID:
00700663
Views:
9
>Hi there folks, I just wanted to share this tip with you all. Hope you might find this useful. Regards
>
>Let's say we wanna create an oledb (ADO) connection by invoking the connection property dialog. Here's the code to do that.
>
>public oConn as adodb.connection
>local oData as object
>
>odata=createobject("datalinks")
>oConn=oData.PromptNew() && We select our data source here
>=oConn.Open()
>
>There it is a valid ado connection without recalling any specific connection string.


Angel:

It is a nice tip, but not new information as Sergey mentioned.

One point that bugs me in your example is the use of a Public variable. Any good reason why?
IMO there is no good reason in this example (or in almost anything done in OOP) for a Public declaration. Try to avoid them as they can create difficult to track bugs.

In this case, if you want to maintain the oConn object in scope you could define it as a property of some object (i.e. a form or an application object).

HTH


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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform