|
-
Sep 30th, 2003, 08:55 AM
#1
Thread Starter
Frenzied Member
Query Method in Database Class
I am writting a database wrapper class (Heres most of the class) I have the db_open, db_state and db_close methods working properly...but now I want to create a db_query and a db_execute methods. I want the db_query to take 2 parameters, the first being a string (possible sql statement or stored procedure name) and the 2nd is a boolean value as to whether or not the first parameter is a stored procedure. But I am somewhat confused as to how to return the data?? I don't want to used a Dataset, because I don't want the recordset to be disconnected, so it is down to either a DataAdapter or a DataReader...obviously just to query (SELECT) records from the database the DataReader would be fine, but how to return the data to the user via a method call???
I have seen methods like this
Code:
public Dataset blah(string blah)
but haven't seen anything regarding how to do it with a DataAdapter or DataReader.
Thanks!
Being educated does not make you intelligent.
Need a weekend getaway??? Come Visit
-
Sep 30th, 2003, 01:06 PM
#2
Tadaaa
It's the Microsoft Data Access Application Block - from the page blurb:
The Data Access Application Block encapsulates performance and resource management best practices and can easily be used as a building block in your own .NET application. If you use it, you will reduce the amount of custom code you need to create, test and maintain.
If I remember correctly, it uses DataReader exclusively.
-
Sep 30th, 2003, 07:58 PM
#3
PowerPoster
It doesn't just use the datareader, it has ExecuteReader, ExecuteDataSet, ExecuteNonQuery, and ExecuteScaler functions. All of which are overloaded to provide the most functionality possible.
I just want to add my vote for the Data Access Block. If you are accessing SQL Server, you really need to use this. It helps so much IMO.
I think that they are updating it, or going to be updating it soon so you can call FillDataSet along with other features. Something to look out for.
-
Sep 30th, 2003, 08:02 PM
#4
PowerPoster
-
Oct 2nd, 2003, 09:27 AM
#5
Thread Starter
Frenzied Member
Hey, thanks for the links hellswraith!
Being educated does not make you intelligent.
Need a weekend getaway??? Come Visit
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|