Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Conditional object dimension
Message
 
À
18/02/2003 11:26:44
Rex Mahel
Realm Software, Llc
Ohio, États-Unis
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Divers
Thread ID:
00754495
Message ID:
00754515
Vues:
19
Hi Rex,

I would recommend tracing through this code in the debugger and see if ConPubs is ever created in the If statement.

>All,
>
>I have a codebehind file that I want to be able to use either the OleDb or Oracle data providers. I have created a strProvider variable and use If statements to dimension Connections, Commands, etc for both Oracle and Oledb. After dimensioning the objects, I try to open the connection outside the if statement, since the connection object is created by that time, but the compiler says the object is undefined.
>
>
>Dim strProvider As String = "OracleClient"
>
>If strProvider = "OracleClient"
>	Dim ConPubs As New OracleConnection(odh)
>Else
>	Dim ConPubs As New OleDbConnection(odh)
>End If
>
>ConPubs.Open()
>
>
>Is there a way to set this so I can conditionally create an object and use them?
>
>Thanks
>
>Rex
-----------------------------------------

Cathi Gero, CPA
Prenia Software & Consulting Services
Microsoft C# / .NET MVP
Mere Mortals for .NET MVP
cgero@prenia.com
www.prenia.com
Weblog: blogs.prenia.com/cathi
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform