>>
>>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