P
Patreek
Hi,
I'm writing my first real asp.net app at my job, and I'd like opinions
please. In my classic ASP apps that I've written, I'd often have separate
files for retreiving data and returning the data to other pages that would
call it. I'd return the data as arrays so that I wouldn't have to have my
DB connections open all the time while the pages ran. Now in .net, it seems
like I have to choose between using a SQldatareader or a dataset. From what
I'm reading, I can see parallels between the sqldatareader and an classic
connected recordset, whereas a dataset seems to be kind of like a
disconnected recordset. But the dataset has lots of overhead.
So, it seems as thought if I use a function to return a datareader, I have
to leave the connection open. That seems sloppy as I'd wind up with
something like.
dataclass.Openconnection
thedatagrid.datasource dataclass.functionThatReturnsDatareader
thedatagrid.databind
dataclass.Closeconnection
I just feel that the open/close lines would get on my nerves after a while.
I could use a dataset instead, but I'm scared to use that after what I've
read about the unnecessary bloat. Does anyone have any examples of what you
do that you think is nice and clean and still keeps your database code
separate from your app?
Thanks!!!
I'm writing my first real asp.net app at my job, and I'd like opinions
please. In my classic ASP apps that I've written, I'd often have separate
files for retreiving data and returning the data to other pages that would
call it. I'd return the data as arrays so that I wouldn't have to have my
DB connections open all the time while the pages ran. Now in .net, it seems
like I have to choose between using a SQldatareader or a dataset. From what
I'm reading, I can see parallels between the sqldatareader and an classic
connected recordset, whereas a dataset seems to be kind of like a
disconnected recordset. But the dataset has lots of overhead.
So, it seems as thought if I use a function to return a datareader, I have
to leave the connection open. That seems sloppy as I'd wind up with
something like.
dataclass.Openconnection
thedatagrid.datasource dataclass.functionThatReturnsDatareader
thedatagrid.databind
dataclass.Closeconnection
I just feel that the open/close lines would get on my nerves after a while.
I could use a dataset instead, but I'm scared to use that after what I've
read about the unnecessary bloat. Does anyone have any examples of what you
do that you think is nice and clean and still keeps your database code
separate from your app?
Thanks!!!