What you want to see on DotNetFunda.com ?
DotNetFunda.Com Logo
Twitter TwitterLinkedIn
YouTubeGoogle
 Online : 12475 |  Welcome, Guest!   Register  Login
 Home > Interview Questions > ADO.NET Interview Questions > In which conditions usage of SqlDataRead ...

In which conditions usage of SqlDataReader is better than Dataset and vice-versa ?

Interview question and answer by: Rajkatie | Posted on: 7/3/2012 | Category: ADO.NET Interview questions | Views: 923 | | Points: 40


Answer:

Use SqlDataReader in the following conditions

•If you want to reduce the memory footprint of your application.

•Want to avoid the object creation overhead associated with the DataSet.

•Want to streamline and optimize your data access.

•Want to read row which contains BLOB (binary large object) columns.

•Wan to perform data binding with a control that support a data source which implement IEnumerable .

Use Dataset in the below condition

•Want in-memory relational view of the data for xml or non-xml manipulation.

•Want to retrieved data from multiple data source s like table,files or databases.

•Want to use the batch update facilities.

•Want to disconnected memory-resident cache of data.

•Wan to perform data binding with a control that support a data source which implement IList .

Source: MSDN | Asked In: Many Interviews | Alert Moderator 
Found interesting? Add this to:


 Responses

Posted by: Premalatha | Posted on: 04 Jul 2012 10:08:06 AM | Points: 10 | Alert Moderator 

//dynamicall get our columns position in our reader
int myOrdinal = myReader.GetOrdinal["ColumnName"];


//use the discovered ordinal to retrieve the data
string myString = myReader.GetValue(myOrdinal);

>> Write Response - Respond to this post and get points

Even more ... | Submit Interview Questions and win prizes!

More Interview Questions from Rajkatie

Even more ... | Submit Interview Questions and win prizes!


About Us | Contact Us | The Team | Advertise | Software Development | Write for us | Testimonials | Privacy Policy | Terms of Use | Link Exchange | Members | Go Top
General Notice: If you find plagiarised (copied) contents on this page, please let us know the original source along with your correct email id (to communicate) for further action.
Copyright © DotNetFunda.Com. All Rights Reserved. Copying or mimicking the site design and layout is prohibited. Logos, company names used here if any are only for reference purposes and they may be respective owner's right or trademarks. | 5/25/2013 3:21:20 AM