Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
ASP.NET 1.0 and 1.1 Professional For advanced ASP.NET 1.x coders. Beginning-level questions will be redirected to other forums. NOT for "classic" ASP 3 or the newer ASP.NET 2.0 and 3.5
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Professional section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old January 28th, 2008, 04:16 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , USA.
Posts: 1,111
Thanks: 0
Thanked 3 Times in 3 Posts
Default DataSet

I have a Dataset that I want to add a column to if a value in the Dataset is a certain value.

Dim da As New OleDbDataAdapter(strSQL, strConn)
Dim myDataSet As New DataSet
da.Fill(myDataSet, "dtAnswers")

Dim r As DataRow
Dim myDataTable As DataTable = myDataSet.Tables("dtAnswers")
myDataTable.Columns.Add(New DataColumn("thenotes", GetType(String)))

Dim i As Integer
For Each r In myDataSet.Tables("dtAnswers").Rows
   Response.Write(r("statusid") & " ")
   For i = 0 To myDataTable.Rows.Count - 1
       myDataTable.Rows(i)("thenotes") = r("statusid")
    Next
 Next

The response.write is displaying the correct statusid(s) but I can't figure out how to add that to the column rows. It currently prints the very last ID on every row.

  #2 (permalink)  
Old January 28th, 2008, 04:56 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , USA.
Posts: 1,111
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Solved:
Dim i As Integer
For i = 0 To myDataTable.Rows.Count - 1
   Dim r As DataRow = myDataSet.Tables(0).Rows(i)
   myDataTable.Rows(i)("thenotes") = myFunction(r("statusid"))
Next i

 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Fill a DataSet from another DataSet kamranzafar C# 1 February 7th, 2007 11:14 AM
Fill(dataset) or dataset.load() salemkoten SQL Server 2005 1 November 2nd, 2006 11:04 PM
Converting a untyped dataset to a typed dataset daphnean Visual Studio 2005 0 July 13th, 2006 01:16 AM
Copy dataset to another dataset kapila VB.NET 2 November 13th, 2005 06:25 AM
Re: SQL Server dataset to ACCESS dataset dazzer ADO.NET 0 March 22nd, 2004 05:28 AM



All times are GMT -4. The time now is 04:55 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.