473,322 Members | 1,352 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,322 software developers and data experts.

DataSet Iteration?

Hi All,

What is the most acceptable way of iterating through a DataSet Tables Row
Collections Manually?
As in:

'fill data adapter object with dataset info
Da = New SqlDataAdapter(Cmd)
Da.Fill(Ds)

'iterate through Area Grouops
Do While() ????

'create new drop down list item
lstItem = New ListItem()
lstItem.Text = " -" & rdrAssessmentAreas("name")
lstItem.Value = rdrAssessmentAreas("assmnt_area_id")

'add new list item to drop down list
ddlAssessmentAreas.Items.Add(lstItem)

Loop

Cheers,
Adam

Nov 19 '05 #1
3 1913
I'd suggest something along these lines:

For Each row As DataRow in MyDataSet.Tables(0).Rows
lstItem.Text = row("name").ToString()
Next

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net
"Adam" <ad**@pertrain.com.au> wrote in message
news:eS**************@TK2MSFTNGP15.phx.gbl...
Hi All,

What is the most acceptable way of iterating through a DataSet Tables Row
Collections Manually?
As in:

'fill data adapter object with dataset info
Da = New SqlDataAdapter(Cmd)
Da.Fill(Ds)

'iterate through Area Grouops
Do While() ????

'create new drop down list item
lstItem = New ListItem()
lstItem.Text = " -" & rdrAssessmentAreas("name")
lstItem.Value = rdrAssessmentAreas("assmnt_area_id")

'add new list item to drop down list
ddlAssessmentAreas.Items.Add(lstItem)

Loop

Cheers,
Adam

Nov 19 '05 #2
I'd suggest something along these lines:

For Each row As DataRow in MyDataSet.Tables(0)
lstItem.Text = row("name").ToString()
Next

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net
"Adam" <ad**@pertrain.com.au> wrote in message
news:eS**************@TK2MSFTNGP15.phx.gbl...
Hi All,

What is the most acceptable way of iterating through a DataSet Tables Row
Collections Manually?
As in:

'fill data adapter object with dataset info
Da = New SqlDataAdapter(Cmd)
Da.Fill(Ds)

'iterate through Area Grouops
Do While() ????

'create new drop down list item
lstItem = New ListItem()
lstItem.Text = " -" & rdrAssessmentAreas("name")
lstItem.Value = rdrAssessmentAreas("assmnt_area_id")

'add new list item to drop down list
ddlAssessmentAreas.Items.Add(lstItem)

Loop

Cheers,
Adam

Nov 19 '05 #3
Beautiful!

Thanks.

"Steve C. Orr [MVP, MCSD]" <St***@Orr.net> wrote in message
news:uN**************@TK2MSFTNGP14.phx.gbl...
I'd suggest something along these lines:

For Each row As DataRow in MyDataSet.Tables(0).Rows
lstItem.Text = row("name").ToString()
Next

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net
"Adam" <ad**@pertrain.com.au> wrote in message
news:eS**************@TK2MSFTNGP15.phx.gbl...
Hi All,

What is the most acceptable way of iterating through a DataSet Tables Row
Collections Manually?
As in:

'fill data adapter object with dataset info
Da = New SqlDataAdapter(Cmd)
Da.Fill(Ds)

'iterate through Area Grouops
Do While() ????

'create new drop down list item
lstItem = New ListItem()
lstItem.Text = " -" & rdrAssessmentAreas("name")
lstItem.Value = rdrAssessmentAreas("assmnt_area_id")

'add new list item to drop down list
ddlAssessmentAreas.Items.Add(lstItem)

Loop

Cheers,
Adam


Nov 19 '05 #4

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

Similar topics

35
by: Raymond Hettinger | last post by:
Here is a discussion draft of a potential PEP. The ideas grew out of the discussion on pep-284. Comments are invited. Dart throwing is optional. Raymond Hettinger ...
1
by: Mac | last post by:
I'm trying to validate input from an xml source to a dataset in dotnet2.0. As far as I can see, type errors correctly cause an exception, but values that are the correct type but do not satisify...
8
by: David | last post by:
Hi all, Using C# 1.1 I have a dataset loaded from an XML file. The idea being that if the app (a winform app that relies on a webservice) is offline, then I save data locally in XML and...
5
by: justanothernewbie804 | last post by:
hi all. I have a dataset and would like to do something like "select distinct field1, field2 from fields" against the dataset. I do not have the option of creating a new database table and...
5
by: bob | last post by:
Hi, My app needs to read a text file, compare the data to that already stored in the DB and generate a text file of the differences. The UI displays the text file data and the db data in a...
3
by: Ken Fine | last post by:
This is a question that someone familiar with ASP.NET and ADO.NET DataSets and DataTables should be able to answer fairly easily. The basic question is how I can efficiently match data from one...
0
by: Rob Meade | last post by:
Hi all, I have the following xml file... <?xml version="1.0" encoding="utf-8" ?> <Assembly> <!-- ' The name of the product/application/resource.
3
by: =?Utf-8?B?anAybXNmdA==?= | last post by:
In Visual Studio 2005, I have my DataSet filled with several static tables (they might get changed weekly, but that's about it). With one of these tables in the DataSet, is it possible to select...
13
by: madankarmukta | last post by:
Hi all, Is there any way by which I can export the data from the dataset table to the text file or xls file ? Currently I implemented this by itterating through each row of the table and...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.