Re: Autoincrement value.. Why in new row? How do I get the next value?
From: Colin R. R. Johnson (cj_at_andjsolutions.com)
Date: 12/16/04
- Next message: a.maggiulli: "Custom Data Bindable Classes"
- Previous message: Oleg Ogurok: "Binding to a related column"
- In reply to: Rollasoc: "Autoincrement value.. Why in new row? How do I get the next value?"
- Next in thread: Rollasoc: "Re: Autoincrement value.. Why in new row? How do I get the next value?"
- Reply: Rollasoc: "Re: Autoincrement value.. Why in new row? How do I get the next value?"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 15 Dec 2004 23:53:59 -0500
Hi Rollasoc,
It looks to me like what you want is something like:
DS_Customer.CustomerTableRow newRow =
dsCustomer.CustomerTable.NewCustomerTableRow(); // create a new row
// populate the row
newRow.CustomerName = customerName;
newRow.CustomerAddress = customerAddress;
newRow.CustomerPhone = customerPhone;
// add the row to the table
dsCustomer.CustomerTable.AddCustomerTableRow(newRow);
newRow.CustomerNext will equal the new value from the auto increment field.
Hope that helps.
Rollasoc wrote:
> Hi,
>
> I have created added a Dataset to my project. In this dataset I have added
> a table which has an ID column. I have set this column to autoincrement.
> The dataset will be persisted using XML in a flat file.
>
> When I try to add a new row in code, it is expecting an ID in the add row
> function. I would have thought it would be more useful to add the row and
> it reutrn me the value. How can I achieve this?
>
> e.g.
> DS_Customer dsCustomer = new DS_DN9848();
>
> int CustomerNext = ?????????????????????????????????;
>
> dsCustomer.CustomerTable.AddCustomerRow(CustomerNext , CustomerName,
> CustomerAddress, CustomerPhone);
>
> How do I find out what the next customer ID is (so I can populate
> CustomerNext)?
>
> Rollasoc
> PS This is a single user application.
>
>
>
>
>
>
-- Colin R. R. Johnson C&J Solutions - Remember, everything you see on screen is but ones and zeroes.
- Next message: a.maggiulli: "Custom Data Bindable Classes"
- Previous message: Oleg Ogurok: "Binding to a related column"
- In reply to: Rollasoc: "Autoincrement value.. Why in new row? How do I get the next value?"
- Next in thread: Rollasoc: "Re: Autoincrement value.. Why in new row? How do I get the next value?"
- Reply: Rollasoc: "Re: Autoincrement value.. Why in new row? How do I get the next value?"
- Messages sorted by: [ date ] [ thread ]