?
Solved

Collection data into a datagrid

Posted on 2003-12-05
1
Medium Priority
?
341 Views
Last Modified: 2010-04-17
In a VB.NET webform, I'm trying to display data.
I have created a collection containing the data and now want to use a datareader to display it in a datagrid.

Could someone tell me what additional lines of code to use (after the "coll ..... line" to get the collection displayed into a datagrid? Here is the loop that puts data in the collecrion:

            Do While DataReader.Read
            collOperatorActionsByActionCode_PerfRate.Add(DataReader.Item("Rate"))

            Loop

Thanks,
Michael
0
Comment
Question by:michael5865
1 Comment
 
LVL 9

Accepted Solution

by:
malharone earned 2000 total points
ID: 9885975
why not just

datagrid1.datasource=SOURCE_TYPE

where the SOURCE_TYPE could be any one of the following:
DataTable
DataSet
DataView
DataViewManager


so instead of getting the reader, get the dataset object from the SQLDATAADAPTER or the OLEDBDATAADAPTER.

0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

864 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