Link to home
Start Free TrialLog in
Avatar of nzfire
nzfire

asked on

SQL Queries and Stored Procedures

Hi All,

I would like to use the datareader and the sqlconnection to access records in my db. I am brand new to .net and have an application to convert.

What is the most efficient data access method??

Could someone give me an example of a complete SUB where a connection is made and then a dataset/ datareader is populated from a stored proc with parameters.

Sorry I don't have my code in front of me.

What is the deal with tableadapters? Are they  efficient? I am using a direct connection to the DB by the way.

Thanks
Avatar of Fahad Mukhtar
Fahad Mukhtar
Flag of Pakistan image

I think you better use datareader which is faster than dataset
here is an article with source code that explains scenario in which a connection is made and then a dataset/ datareader is populated
http://www.startvbdotnet.com/ado/sqlserver.aspx
http://www.csharpfriends.com/Articles/getArticle.aspx?articleID=1

To read difference in dataset and datareader check:
http://www.sitepoint.com/article/dataset-datareader
http://www.eggheadcafe.com/forums/ForumPost.asp?id=67487&ThreadID=67487&INTID=14
tableadapters(use to fill a dataset) are efficient but datareaders are more
Avatar of LordWabbit
LordWabbit

But if you open a datareader the connection used is not re-usable by aything untill you close the datareader.  Not particularly fond of datareaders myself.
Avatar of Bob Learned
Yeah, but DataReaders are very light-weight, if you only need read-only data.

Bob
ASKER CERTIFIED SOLUTION
Avatar of wtconway
wtconway

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial