what's the best way...

G

Guest

hey all,

i have a combo of dropdownlists and a textbox that allows a user to filter
her dataset for a datagrid on a webform. the way i'm doing it now is i have
an array that i pass from the ui, thru the business layer, into the data
access layer so i can build my SQL statement dynamically. i have public enums
that describe the contents of my array both on the ui and on the
dataaccesslayer.

does this sound ok to do, or is there a better (preferred way)? does this
sound too coupled?

thanks,
ari
 
L

Lucas Tam

i have a combo of dropdownlists and a textbox that allows a user to
filter her dataset for a datagrid on a webform. the way i'm doing it
now is i have an array that i pass from the ui, thru the business
layer, into the data access layer so i can build my SQL statement
dynamically. i have public enums that describe the contents of my
array both on the ui and on the dataaccesslayer.

Depending on how large your data set is... you can use a Dataview.

A dataview allows you to dynamically filter a dataset without requerying
the database.
 
G

Guest

for the search, i want to go to the database. does what i do sound good? or
is there a better way?
 
I

intrader

hey all,

i have a combo of dropdownlists and a textbox that allows a user to filter
her dataset for a datagrid on a webform. the way i'm doing it now is i have
an array that i pass from the ui, thru the business layer, into the data
access layer so i can build my SQL statement dynamically. i have public enums
that describe the contents of my array both on the ui and on the
dataaccesslayer.

does this sound ok to do, or is there a better (preferred way)? does this
sound too coupled?

thanks,
ari
It seems a little convoluted to pass an array. I think your goal is
correct in hiding the UI details from the Business Layer and from the Data
Access layer.
I like an approach in which the UI expresses the Business Layer, and the
Data Access layer is accessed by the Business Layer. So first get an
instance of you Business Object, have it handle the values present in the
Request, then tell the Business Object to update.
I like the publication by Rockford Lhotka (specially Expert C# Business
Objects).
 
L

Lucas Tam

for the search, i want to go to the database. does what i do sound
good? or is there a better way?

Depends on how much data you're dealing with.

If your dataset is small - you might want to place it into a dataset.

But otherwise, yes, going against the database is OK if you have a lot of
data.
 
G

Guest

so how would you gracefully pass the values of 2 drop-down lists and a
textbox down to the business object? thru a public property or something?
 
I

intrader

so how would you gracefully pass the values of 2 drop-down lists and a
textbox down to the business object? thru a public property or something?
The business object should have get/set properties for what you want. The
set side should perform validation according to the rules applicable in
the object.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,565
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top