Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Return type of ExecuteReader

Posted on 2006-11-01
8
Medium Priority
?
1,399 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
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.

 
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 750 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

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.

Question has a verified solution.

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

Article by: Ivo
C# And Nullable Types Since 2.0 C# has Nullable(T) Generic Structure. The idea behind is to allow value type objects to have null values just like reference types have. This concerns scenarios where not all data sources have values (like a databa…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

618 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