Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Populating OleDbParameterCollection
Message
De
23/12/2005 13:25:14
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
23/12/2005 13:12:27
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Divers
Thread ID:
01080445
Message ID:
01080606
Vues:
32
>>
>>Public oParameters As OleDbParameterCollection
>>...
>>oParameters = oDataAdapter.SelectCommand.Parameters
>>
>>
>>oParameters doesn't sound to be a good naming really.
>>
>>
>>loDataProvider.oDataAdapter.SelectCommand.Parameters.Add( ... )
>>loDataProvider.oDataAdapter.UpdateCommand.Parameters.Add( ... )
>>loDataProvider.oDataAdapter.InsertCommand.Parameters.Add( ... )
>>
>>
>>PS: Might not be right. Thinking C# wrting VB:)
>
>I am trying to set this up in a class. Once the class is instantiated this is when I initialize the oParameters property. So, I create it like this:
>
>
>        Dim loDataProvider As Framework.Data = New Framework.Data
>        loDataProvider.oParameters.Add(New OleDbParameter("@Username", lcUsername))
>        If loDataProvider.SQLExec("SELECT Numero,Password,Session FROM " + tcTable + _
>         " WHERE Username=""" + lcUsername + """", tcConnection) = False Then
>            Framework.App.nLoginSuccess = 4
>            Return False
>        End If
>
>
>so I can have an instance of the class, initialize oParameters property and then call the method.
>
>Why also do you think oParameters is not a good representation of the property name?

OleDbParameterCollection is a sealed collection class with no constructor. You can't initialize it with new but indirectly get it. ie: DataAdapter.SelectCommand.Parameters is of type OleDbParameterCollection.

Look at its sample. Instead of:
public oParameters as Ole...

it uses it as a method:

public void AddOleDbParameter()

which I also think an easier way.

I thought it was not a good naming because a DataAdapter has multiple commands (Select,Update, Delete, Insert) each might be using different set of parameters. So I would rather name oSelParms, oInsParms etc

You mean you'd replace this call, right? (do replace-dangerous IMHO)
        If loDataProvider.SQLExec("SELECT Numero,Password,Session FROM " + tcTable + _
         " WHERE Username=""" + lcUsername + """", tcConnection) = False Then
            Framework.App.nLoginSuccess = 4
            Return False
        End If
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform