Re: Autoincrement value.. Why in new row? How do I get the next value?

From: Rollasoc (hotmail_at_hotmail.com)
Date: 12/16/04


Date: Thu, 16 Dec 2004 13:00:31 -0000

Colin,

Unfortunatly, there is no default constructor to use.

Rollasoc

"Colin R. R. Johnson" <cj@andjsolutions.com> wrote in message
news:Dx8wd.18864$%p1.1410054@news20.bellglobal.com...
> 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.


Loading