samsmithnz Posted February 9, 2004 Posted February 9, 2004 (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 February 9, 2004 by samsmithnz Quote Thanks Sam http://www.samsmith.co.nz
Moderators Robby Posted February 9, 2004 Moderators Posted February 9, 2004 You're assigning a new row to objDR but adding objNewDataRow to the Rows.Add method. Is that a typo? Quote Visit...Bassic Software
samsmithnz Posted February 9, 2004 Author Posted February 9, 2004 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? Quote Thanks Sam http://www.samsmith.co.nz
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.