Results 1 to 2 of 2
  1. #1
    Lounger
    Join Date
    May 2006
    Posts
    33
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Adding ad-hoc row to db-filled dataset (vb.net 2.0)

    As an odd requirement to interface to an old system, I have ran into this problem...
    there is a table, called tblAccounts, which holds information to be exported into a csv file
    this csv file must start with one blank row (column headings), which will be ignored.
    I have a dataset that is filled from this tblAccounts table, but have not been able to successfully insert a blank row...
    maybe this is a bit of my lack of understanding of the ins and outs of datasets...

    My thought was that I would be able to create a dataTable named "tblAccounts" in the dataset, create a row, and add it to the dataset... but it has given me problems continuously...

    is there an easy way to just insert a blank row at the top of a dataset...? This seems like pretty easy stuff but the mash-up of the database-filled content and the hard-coded content is confusing things a bit.
    Thanks

  2. #2
    Lounger
    Join Date
    May 2006
    Posts
    33
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Adding ad-hoc row to db-filled dataset (vb.net 2.0)

    Spoke too soon-- turns out it isn't a problem to add rows post-facto after all...
    sort of looks like this:

    da.Fill(ds)
    Dim newRow As DataRow
    newRow = ds.Tables(0).NewRow()
    ds.Tables(0).Rows.InsertAt(newRow, 0)

    what I was missing was the rows.insertAt() function, which works differently than the add() function... I would have thought that it would just be an overload of the add() function.

    Seems that all I have to do is ask and I will immediately find what I was looking for. [img]/forums/images/smilies/wink.gif[/img]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •