T
tma
In my case, the column is defined as PK in Enterprise Manager. My issue is
adding a new row to a dataset which includes the PK/Auto increment column.
Without setting a value for that column, I get a Null error on the
column.add method. I'm going to get to reading your suggestion.
adding a new row to a dataset which includes the PK/Auto increment column.
Without setting a value for that column, I get a Null error on the
column.add method. I'm going to get to reading your suggestion.
Ron Allen said:tma,
Is the column defined as the primary key in Enterprise Manager? Just
having it as Autoincrement doesn't make it the primary key which may be
confusing the SqlClient modules. An autoincrement PK shouldn't be in an
insert statement at all as it should be generated by the database (and sent
back to the program for update). See the topic 'Retrieving Identity or
Autonumber Values' in the online help for a discussion on this. The ref isms-help://MS.VSCC.2003/MS.MSDNQTR.2003FEB.1033/cpguide/html/cpconretrievingi
dentityorautonumbervalues.htm
on my system.
Ron Allen
tma said:I am ignorant as to how I can set properties of a column in a typed dataset.
Viewing the dataset in the designer reveals the following properties:
AutoIncrement = True
AutoIncrementSeed = [blank]
AutoIncrementStep=[blank]
ReadOnly=True
Type=int
I am creating a dataset based on the dataset I created from the data adapter
for the table.
I'm sorry I don't even know enough to adequately explain my problems...
whereMiha Markic said:Hi,
Yes, but how the column is defined in the program?
Check out DataColumn.AutoIncrement* properties.
--
Miha Markic [MVP C#] - RightHand .NET consulting & development
miha at rthand com
www.rthand.com
In Enterprise Manager, the column values are the following:
Identity = Yes
IdentitySeed = 100
IdentityIncrement = 1
The data type is Int = 4.
"Miha Markic [MVP C#]" <miha at rthand com> wrote in message
Is the column in datatable set as autoincrement?
--
Miha Markic [MVP C#] - RightHand .NET consulting & development
miha at rthand com
www.rthand.com
Can someone help with how I might add a datarow to a dataset
thePrimary Key is an identity column and as such does not receive its
value
until the row is inserted into the db?
I get a null error adding the row to the dataset without a value in
the
PK
field.
Is this poor design or use of the identity field or is there a
technique
I
need to learn to accomplish this correctly?
Thanks.