Cor Ligthert [MVP]
10/4/2007 5:22:00 PM
Hi,
You know that adding a parameter to the parametercollection is extremely
simple.
WhaterCommand.Parameters.Add(new SqlParameter("@TheFirstOne", "TheValue")
with an ending ";" for C#.
Mostly you see extreme difficult samples.
I would not make it more difficult than it is.
Cor
"cashdeskmac" <cashdeskmac@discussions.microsoft.com> schreef in bericht
news:389DA3E3-481B-495A-B827-94AB3DC77060@microsoft.com...
> Cor,
>
> the idea is that I can populate a HashTable with the name of the parameter
> and it's value and pass it to the data layer, where these values are used
> to
> construct the SqpParameters needed for the SqlCommand.
>
> I thought about creating the SqlParameters in the UI and passing an array
> of
> them to the data access layer, but then I am splitting the work of the
> data
> layer between two layers.
>
> My idea is that whoever is using the data layer can simply pass in the
> name
> of the parameter and it's value and not worry about anything else, making
> it's use extremely simple.
>
> Just to let you know how I am doing it, I have a constants file who's
> members map to the fields in the database. The user selects the constant
> they need and the value for the parameter and add it to the HashTable as
> the
> key/value pair. They pass these to a method in the data layer and it does
> the rest.