473,809 Members | 2,708 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Bind datareader to datagrid



Hi...

My program make a select to an table and return the results to a
datagrid, it's all ok with dataset, but in large tables it needs to get
the entire table to show in datagrid and sometimes it takes much time...

So I thik of use the datareader, but how can I bind the data that it is
picking from the database to the datagrid???

thx...

*** Sent via Developersdex http://www.developersdex.com ***
Nov 17 '05 #1
6 5080
Hi,

Using the same way:

SqlDataReader reader = GetReader();
datagrid.DataSo urce = reader;
datagrid.DataBi nd();
reader.Close();

Note that you NEED to close the datareader !!! , otherwise you could let the
connection open.

Have you considered pagination?
cheers,
"Ricardo Luceac" <rl*****@gmail. com> wrote in message
news:OM******** ******@TK2MSFTN GP15.phx.gbl...


Hi...

My program make a select to an table and return the results to a
datagrid, it's all ok with dataset, but in large tables it needs to get
the entire table to show in datagrid and sometimes it takes much time...

So I thik of use the datareader, but how can I bind the data that it is
picking from the database to the datagrid???

thx...

*** Sent via Developersdex http://www.developersdex.com ***

Nov 17 '05 #2
Hi,

Using the same way:

SqlDataReader reader = GetReader();
datagrid.DataSo urce = reader;
datagrid.DataBi nd();
reader.Close();

Note that you NEED to close the datareader !!! , otherwise you could let the
connection open.

Have you considered pagination?
cheers,
"Ricardo Luceac" <rl*****@gmail. com> wrote in message
news:OM******** ******@TK2MSFTN GP15.phx.gbl...


Hi...

My program make a select to an table and return the results to a
datagrid, it's all ok with dataset, but in large tables it needs to get
the entire table to show in datagrid and sometimes it takes much time...

So I thik of use the datareader, but how can I bind the data that it is
picking from the database to the datagrid???

thx...

*** Sent via Developersdex http://www.developersdex.com ***

Nov 17 '05 #3


Sory but what is that GetReader()???

What is Pagination...

see ya...

*** Sent via Developersdex http://www.developersdex.com ***
Nov 17 '05 #4


Sory but what is that GetReader()???

What is Pagination...

see ya...

*** Sent via Developersdex http://www.developersdex.com ***
Nov 17 '05 #5

"Ricardo Luceac" <rl*****@gmail. com> wrote in message
news:Oc******** ******@TK2MSFTN GP10.phx.gbl...


Sory but what is that GetReader()???
That is any method that you use to get a DataReader, you hvae to change it
to reflect the name you used.
What is Pagination...
Is how you display a large table, you show only X records and use some way
to go a Next and/or Prev

cheers,

see ya...

*** Sent via Developersdex http://www.developersdex.com ***

Nov 17 '05 #6

"Ricardo Luceac" <rl*****@gmail. com> wrote in message
news:Oc******** ******@TK2MSFTN GP10.phx.gbl...


Sory but what is that GetReader()???
That is any method that you use to get a DataReader, you hvae to change it
to reflect the name you used.
What is Pagination...
Is how you display a large table, you show only X records and use some way
to go a Next and/or Prev

cheers,

see ya...

*** Sent via Developersdex http://www.developersdex.com ***

Nov 17 '05 #7

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

Similar topics

1
3282
by: Al | last post by:
in order to implement sorting, paging in a datagrid, can I have the datasource of the datagrid a datareader or it must be a dataset then I create a dataview and make it a datasource of the datagrid? The reason I am asking this question is because I already created a datagrid and made its datasource a datareader, yet, could not implement sorting or paging. Any idea of how to approach it . thanks
0
382
by: Ricardo Luceac | last post by:
Hi... My program make a select to an table and return the results to a datagrid, it's all ok with dataset, but in large tables it needs to get the entire table to show in datagrid and sometimes it takes much time... So I thik of use the datareader, but how can I bind the data that it is picking from the database to the datagrid??? thx...
2
1549
by: timmso | last post by:
I got this sample of code from Mike Moore in response to my question of how I create clickable links from a data source. <asp:Repeater id="Repeater1" runat="server"> <ItemTemplate> <asp:HyperLink id="HyperLink1" runat="server" NavigateUrl='<%# "http://localhost/ngrid1/repeater.aspx?a=" & Container.DataItem("au_lname") %>'>'<%# DataBinder.Eval(Container.DataItem, "au_fname")%>'</asp:HyperLink> <br> </ItemTemplate>
3
2328
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 bind that to the datagrid? I have never done either (usually I get a recordset from a stored procedure and bind results directly). I also don't know which is faster. Whichever you suggest, can you give a couple lines of sample code? Thank...
7
1817
by: Bart Schelkens | last post by:
Hi, I have 2 more questions : 1. Can I fill a datagrid by using a DataReader or does it have to be a DataSet or a DataView? 2. In my datagrid I need to display two images and one of does images has te be a link to a new page. How would you do that ?
4
1171
by: Shapper | last post by:
Hello, I have this code to bind a DataGrid to a DataReader when page loads: Sub Page_Load(Sender As Object, e As EventArgs) dgContent.DataSource = drContent dgContent.DataBind() End Sub It's not working. What is wrong?
1
1402
by: Fred Flintstone | last post by:
Just new to .net, and started using oledb connection to database. After getting most things working, now want to bind to a datagrid, but have not been successful as of yet. Will use alternate db connection with dataset if necessary, but hoping not to mix connection types in same project, and hoping not to rewrite existing code using other methonds. Any assistance appreciated.
1
1419
by: Niclas | last post by:
Hi, I am using a SQL query that uses a CURSOR to loop and executes a SELECT statement in each loop. When I bind a datagrid to this stored procedure through a datareader as data source, I only get the first SELECT statement in the grid. Is there a known workaround to this ? Niclas
0
1247
by: pbd22 | last post by:
Hi. I am returning to an old bit of code in our program and need to figure out how to sort my columns on bind. I am sorting on Date (mostly) and some other values. Problem is, the code is an ArrayList that seems to do some tricky stuff with a chache object and I am unable to get any sort of sorting happening.
0
9721
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9601
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10115
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6881
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5550
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5687
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4332
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3861
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3014
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.