First column is PK_ID with identity yes(1,1) can i check PK in rowset data.

Hi i am using the sql server so in my database table first element is set to primary key which is an integer type. I am able to submit the data only if i uncheck(False) the primary key(PK_ID) element in my cachedrowset. If i check the PK_ID element then it is showing error like cannot explicitly insert the values to Table1.ID . so what is the right procedure to proceed. Please confirm it . and help me in regarding this.

Thank You in Advance.

[465 byte] By [Srinivasan1983a] at [2007-11-26 12:43:34]
# 1

Hi Srinivasan,

Check out http://blogs.sun.com/jfbrown/date/20050921

Quoting some Q&A's related to IDENTITY colum from the above blog item.

<quote>

What about IDENTITY or AUTOINCREMENT or other database-generated columns?

This is highly database dependent. Some databases require you to obtain the key through vendor-specific means. Others say "set the value to null". Some say to not include the column in the INSERT statement.

So how do I exclude my IDENTITY or other column from the INSERT statement?

Use the RowSet's advanced insertableColumns property. Create a boolean[] array with one value for each column in the result. Use true to include the column in the INSERT statement, otherwise use false. The RowSet's property sheet doesn't allow you to set this property (in Creator2-EA2), so set the property in your java code.

After the INSERT, how do I retrieve any database generated value?

Unfortunately, we do not offer a way to easily obtain this. You will have to reselect the data to find the generated value.

</quote>

HTH,

Sakthi

sakthivel.gopala at 2007-7-7 16:19:46 > top of Java-index,Development Tools,Java Tools...