Solved

Return type of ExecuteReader

Posted on 2006-11-01
8
1,367 Views
Last Modified: 2008-01-16
Hello Experts

If I use ExecuteReader property of command object , get data from database (eg. Select * from Employee).

The data returned is in which format...XML / Binary or ...

Thanks in advance.
0
Comment
Question by:winsoftech
8 Comments
 
LVL 35

Expert Comment

by:Raynard7
ID: 17848639
Hi,

The data is binary - which is then converted by c# to a data readable format ie dates etc...
0
 
LVL 1

Author Comment

by:winsoftech
ID: 17848694
So u mean to say all table data comes in binary format.

When i binnd this command.ExecuteReader () to datagrid, then datagrid stores the data in XML format. ???

Also when and by whome this binary data is converted into readable formats..(CLS or something)
0
 
LVL 3

Expert Comment

by:lizard450
ID: 17848717
It returns a DataReader, specifically a SqlDataReader.   Forward only and lightweight.  You can output a SqlDataReader to XML.  

You can convert a datareader to a dataset here

http://authors.aspalliance.com/stevesmith/articles/convertReadertoSet.asp

A dataset automatically seralizes to XML, and a dataset is not forward only.  

thanks,

Jon
0
U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

 
LVL 1

Author Comment

by:winsoftech
ID: 17848769
Exactly , my question starts from there only.
Whats the format of data inside SqlDataReader/OracleDataReader.
In which format data is stored in SqlDataReader/OracleDataReader.
 
0
 
LVL 1

Author Comment

by:winsoftech
ID: 17848778
And what happens when I directly assign data to DataGrid

DataGrid1.DataSource = com.ExecuteReader();
DataGrid1.DataBind();


Hows the conversion goes.(This isquestion 2)
0
 
LVL 20

Accepted Solution

by:
TheAvenger earned 250 total points
ID: 17852772
The XxxDataReader does not contain the data. It is just an object which gives you read only, forward only access to the data. The data is transfered between the database and your application in a format defined by the database connectivity (OLE DB, ODBC, etc.). Every time you request a record and a field the XxxDataReader and the other help objects know how to convert the data in order to provide it to you in the correct C# format (e.g. int, string, DateTime, etc.).

When you assign a data reader to the data grid datasource and call the DataBind method, the framework will go over the records and for every record over the fields and set the data in the data grid. This is repeated as long as there is more data comming back from the database. Note that the data is NOT in the data reader but rather is read by the data reader when it is needed. You can imagine it like: you make a request to the database and the data reader "opens the door" to one record at a time. You read it and the data reader lets the other one go in and so on until all data is read.
0
 
LVL 1

Author Comment

by:winsoftech
ID: 17855711
So DataReader makes connection between DataGrid and DataBase.
So data taken from Database  is in Binary format and stored in DataGrid in XML format.
???
This is done by CLR or ???
Can i get full backgroung process ...
0
 
LVL 20

Expert Comment

by:TheAvenger
ID: 17856068
AFAIK the data is never stored in XML format. In the DataGrid the data is stored as values, the grid is rendered and that's it.
0

Featured Post

Is Your AD Toolbox Looking More Like a Toybox?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Server Error 11 58
Question! 4 36
Graphics 2 30
Example works but why do I need to click twice on button 4 43
Introduction This article series is supposed to shed some light on the use of IDisposable and objects that inherit from it. In essence, a more apt title for this article would be: using (IDisposable) {}. I’m just not sure how many people would ge…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

832 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question