G
Guest
Hi,
I am using MS-SQL Server.
Is there any way that I can exam table design strucutre in C# such as
deciding which column is identity(or primary key) or not ?
I mean...
Suppose that this table(Name is Test)...
ID Description
1 A
2 B
3 C
ID is designed as Identity to increase 1 automatically.
In C#,
Suppose that GetDataSet method returns dataset object of the Test table.
Dataset ds = GetDataSet("Select * from Test");
I thought that I could use AutoIncrement property like..
for(int i = 0; i < ds.Tables[0].Columns.Count; i++)
{
if(ds.Tables[0].Columns.AutoIncrement)
{
// It would be identity column....(which is ID column in Test table)
}
}
HOWEVER, I realized that AutoIncrement WASN'T the property for my scenario
after reading msdn..
Any way to determine whehter the column was designed as Identity or not?
Any help would be appreciated.
Thanks.
....................................................TJ
I am using MS-SQL Server.
Is there any way that I can exam table design strucutre in C# such as
deciding which column is identity(or primary key) or not ?
I mean...
Suppose that this table(Name is Test)...
ID Description
1 A
2 B
3 C
ID is designed as Identity to increase 1 automatically.
In C#,
Suppose that GetDataSet method returns dataset object of the Test table.
Dataset ds = GetDataSet("Select * from Test");
I thought that I could use AutoIncrement property like..
for(int i = 0; i < ds.Tables[0].Columns.Count; i++)
{
if(ds.Tables[0].Columns.AutoIncrement)
{
// It would be identity column....(which is ID column in Test table)
}
}
HOWEVER, I realized that AutoIncrement WASN'T the property for my scenario
after reading msdn..
Any way to determine whehter the column was designed as Identity or not?
Any help would be appreciated.
Thanks.
....................................................TJ