Problem Updating DB

  • Thread starter Thread starter Cloud078
  • Start date Start date
C

Cloud078

the source DB has a table with 3 columns

ColumnA (primary key, uniqueidentifier)
ColumnB
ColumnC

my dataset has a new row with values for column B and column C

is there any way i can add my new row to the source DB and have the
source DB generate a primary key? Currently, it tells me i cant add
the new row because a primary key cant be null.

I'm using c# and ms sql server 2000

Thanks in advance for any advice!

*-----------------------*
Posted at:
www.GroupSrv.com
*-----------------------*
 
U¿ytkownik "Cloud078 said:
the source DB has a table with 3 columns

ColumnA (primary key, uniqueidentifier)
ColumnB
ColumnC

my dataset has a new row with values for column B and column C

is there any way i can add my new row to the source DB and have the
source DB generate a primary key? Currently, it tells me i cant add
the new row because a primary key cant be null.

I'm using c# and ms sql server 2000

1. Set DataColumn ColumnA property Autoincrement to true, AutoincrementSeed
to -1, AutoincrementStep to -1,
2. Make own stored proc that will add new record and retrieve actual Id from
server as output parameter,
3. Make appriopriate update code in your application.

There you can find some examples:
http://msdn.microsoft.com/library/d...cpconretrievingidentityorautonumbervalues.asp

I hope it helps.
Regards,
Grzegorz
 
Back
Top