How to add Primary key in DataSet

Answer Posted / kamalakannan.a

If we use c#

DataTable dt=new DataTable();

DataColumn Dc1 = new DataColumn("No", Type.GetType
("System.Int32"));

dt.Columns.Add(Dc1);

//Set Primary key
DataColumn[] dc = new DataColumn[1];
dc[0] = dt.Columns["No"];
dt.PrimaryKey = dc;

Kamal..

Is This Answer Correct ?    34 Yes 7 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is a datareader object?

575


What is execute reader in ado.net?

491


What does ado stand for?

514


What are the pre-requisites for connection pooling?

529


What is Serialization in .NET? what are the types of Serialization?

544






What are the ado.net connection pooling parameters?

457


What are the advantage of ado.net?

513


What is the use of sqldatareader class?

466


What is microsoft ado?

510


What is difference between entity framework and ado.net?

473


Which components of a data provider is used to retrieve, insert, delete, or modify data in a data source?

612


What is ado.net explain with diagram?

505


How do you implement locking concept for dataset?

541


What do you know about ado.net's methods?

579


What is the full form of ado.net?

504