473,386 Members | 1,706 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Proper way to bind data from sqlserver to datagrid

I am going to show database table to a datagrid.
I try to select the table to a sqlDataReader,
but I found it is not straight to show it to the datagrid.
It needs to convert the sqldatareader to a data table and add the
datatable to a dataset,
then setdatabinding from the datagrid ...

Is it a standard way to load data to the datagrid for display only?

Thanks.

Apr 20 '07 #1
1 1183
Cylix,

You can use the sqlDataReader direct to the ASPX datagrid, probably you have
read about the windonsforms datagrid, which need as you said (although you
can bind direct a datatable as well to that one)

Cor

"Cylix" <cy*******@gmail.comschreef in bericht
news:11********************@p77g2000hsh.googlegrou ps.com...
>I am going to show database table to a datagrid.
I try to select the table to a sqlDataReader,
but I found it is not straight to show it to the datagrid.
It needs to convert the sqldatareader to a data table and add the
datatable to a dataset,
then setdatabinding from the datagrid ...

Is it a standard way to load data to the datagrid for display only?

Thanks.

Apr 20 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Alpha | last post by:
I have several textboxes that I need to chang the text when the selection row is changed in a datagrid. I have the following code. This textbox displayes the initial selection but when I click on...
2
by: Vijaya | last post by:
Can we bind data to textbox in a headertemplate in a template column of a datagrid? If so please give some code snippets. Thank you
4
by: Greg Linwood | last post by:
I am wondering what the best approach to binding XML data to an asp:Table from the Page_Load event in a code behind module? I'm using VB.Net and initially approached this by adding a table to the...
6
by: coleenholley | last post by:
I have a Class Module written in VB that calls an RPC (written in COBOL) we have written code to read the data from the RPC, and we create a temporary datatable to store the data from the RPC. This...
3
by: AFN | last post by:
I need to manually create the data to be shown in a datagrid (or some data table object). Should I create an array and bind the array to the datagrid OR should I create a temporary dataset and...
3
by: Luis Esteban Valencia | last post by:
Hi, the following code displays a search result in a datagrid and is working without problems. But I think the way I have done is not correct especially databind(). could anyone help me to...
17
by: A_PK | last post by:
I have problem databinding the DataGrid with DataView/DataSet after the filter... I create the following proceudre in order for user to filter as many as they want, but the following code is only...
3
by: serge calderara | last post by:
Dear all, Does anyone know how to bind a System.Collection.ArraysList object to a Dataset ? Thanks for your reply Regards Serge
1
by: Amit | last post by:
Hello , Is there any way i can import data from datagrid to sqlserver. please advise . thanks & Regards
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.