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 15:25:04 -0000

Colin,

Ok, I've sussed it now.... Your code was correct, I was just having a
blonde moment and clicked on the wrong function in the inttelisense.

Thank you very much..

Rollasoc

"Rollasoc" <hotmail@hotmail.com> wrote in message
news:uwcB7824EHA.2288@TK2MSFTNGP11.phx.gbl...
> 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