Problem Updating DB

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
*-----------------------*
 
G

Grzegorz Danowski

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top