Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Just a tip I wanted to share with you
Message
De
15/09/2002 21:29:13
 
 
À
15/09/2002 09:56:35
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Divers
Thread ID:
00700597
Message ID:
00700663
Vues:
10
>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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform