Solved

Return type of ExecuteReader

Posted on 2006-11-01
8
1,363 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
 
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
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Article by: Najam
Having new technologies does not mean they will completely replace old components.  Recently I had to create WCF that will be called by VB6 component.  Here I will describe what steps one should follow while doing so, please feel free to post any qu…
Introduction Although it is an old technology, serial ports are still being used by many hardware manufacturers. If you develop applications in C#, Microsoft .NET framework has SerialPort class to communicate with the serial ports.  I needed to…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

747 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now