Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > asp.net vb existing datatable add row

Reply
Thread Tools

asp.net vb existing datatable add row

 
 
janetb janetb is offline
Junior Member
Join Date: Nov 2006
Posts: 5
 
      02-05-2010
I need to add rows to an existing (maybe) datatable in a dataset that combines the IIS6 index search with my own sql table. I keep getting object reference errors. Anybody help me out? Much thanks.

Code:
        If ds.Tables("list").Rows.Count > 0 Then
            For Each k As Data.DataRow In ds.Tables("list").Rows
                Dim myDate As String
                If Convert.ToInt32(k.Item("structure")) = 4 Then
                    myDate = "Online - " & k.Item("eTitle").ToString
                Else
                    myDate = k.Item("mDate").ToString & "  - " & k.Item("eTitle").ToString
                End If
                Dim objRow As System.Data.DataRow = ds.Tables("listSearch").NewRow
                objRow("filename") = "Some Class"
                objRow("characterization") = myDate
                objRow("rank") = "1100"
                objRow("path") = "SomePath.apsx?eid=22"
                ds.Tables("listSearch").Rows.Add(objRow)
            Next
        End If
 
Reply With Quote
 
 
 
 
janetb janetb is offline
Junior Member
Join Date: Nov 2006
Posts: 5
 
      02-08-2010
Figured out what I was doing wrong. I was binding the first dataset and then adding the second set so it didn't get added to the display. Switched things around and it's working beautifully now. Sorry to be so dense. Hope this helps someone else.
 
Reply With Quote
 
 
 
Reply

Thread Tools

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
DataTable - Add New Row as First Row Paul ASP .Net 1 07-11-2008 08:18 PM
Add a row to datatable =?Utf-8?B?UGF0cmljayBG?= ASP .Net 1 08-08-2006 02:29 PM
add row from dataview to DataTable MattB ASP .Net 3 11-10-2005 05:20 PM
How to add New Column to existing DataTable in specific position. GoodMorningSky ASP .Net Datagrid Control 4 10-06-2004 10:04 PM
How can I add a row from a typed datatable to another instance of that typed datatable? Ersin Gençtürk ASP .Net 1 10-06-2004 01:11 PM



Advertisments