how can i know column have identity true in runtimes

  • Thread starter Thread starter Neeraj
  • Start date Start date
N

Neeraj

Hi all.
I have stuck at a strange point.in Database some master table have
identity column and some havenot. Then How can i know at runtimes that
which table have identity column.
According to this i have to write query string.

I got dataset from table.
and
write
ds.Tables[0].Columns[0].AutoIncrement
which always gives false.

If youmhave any idea please share with me

Thanks
Neeraj
 
Neeraj said:
Hi all.
I have stuck at a strange point.in Database some master table have
identity column and some havenot. Then How can i know at runtimes that
which table have identity column.
According to this i have to write query string.

I got dataset from table.
and
write
ds.Tables[0].Columns[0].AutoIncrement
which always gives false.

If youmhave any idea please share with me

Thanks
Neeraj

Quite a few people see this property as what you thought, an identity field
in the database. What they don't see clearly is that the property means to
auto-increment for the DataRow being added to the DataTable (not for the
dbms, but for the .Net DataTable).

What type of database are you using? If SQL Server, then you can use the
stored procedure sp_columns to return a dataset/table that contains all of
the column definitions (including whether they are an identity field).

HTH,
Mythran
 

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

Back
Top