Solved

Return type of ExecuteReader

Posted on 2006-11-01
8
1,365 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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 Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…

895 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

14 Experts available now in Live!

Get 1:1 Help Now