Jump to content
Xtreme .Net Talk

Recommended Posts

Posted (edited)

I'm trying to add and remove rows to my dataset. I have a problem though, when I remove the last row, it seems to also remove the table from the dataset, whereas I'd like to just have an empty table.

 

Here's what I do. First I load a table from SQL into a dataset.

 

Here's my delete code:

dsInvoiceItems.Tables(0).Rows.Item(intSelectedItem).Delete()

Here's my add code:

'Add a new row to the dataset (This is the line that fails)
objDR = dsInvoiceItems.Tables("InvoiceItem").NewRow
dsInvoiceItems.Tables("InvoiceItem").Rows.Add(objDR)

 

What am I doing wrong here..?

Edited by samsmithnz
Posted

opps sorry yes it is. Thats what you get for trying to only cut out the very minimum amount of code.

 

I think I may know the problemnow.... I think (I THINK) I need to make a XSD file, and convert it to a dataset, so that it creates that vb module... then the datarow will be strongly typed...

 

does that sound right?

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...