Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1407
  • Last Modified:

Return type of ExecuteReader

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
winsoftech
Asked:
winsoftech
1 Solution
 
Raynard7Commented:
Hi,

The data is binary - which is then converted by c# to a data readable format ie dates etc...
0
 
winsoftechAuthor Commented:
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
 
lizard450Commented:
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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
winsoftechAuthor Commented:
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
 
winsoftechAuthor Commented:
And what happens when I directly assign data to DataGrid

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


Hows the conversion goes.(This isquestion 2)
0
 
TheAvengerCommented:
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
 
winsoftechAuthor Commented:
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
 
TheAvengerCommented:
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

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now