Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


How to add Primary key in DataSet

Answers were Sorted based on User's Feedback



How to add Primary key in DataSet..

Answer / 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

How to add Primary key in DataSet..

Answer / gopi

ds.Tables[0].Constraints.Add("pk_sid",
ds.Tables[0].Columns[0], true);

Is This Answer Correct ?    29 Yes 4 No

How to add Primary key in DataSet..

Answer / shahil singh

dim col() as new dt.datacolumn
col(0)=dt.column(1)
dt.primarykey=col

Is This Answer Correct ?    30 Yes 8 No

How to add Primary key in DataSet..

Answer / r.prajapati

In eidt dataset designer right click on column name which u
want as primary key and set it as pk

Is This Answer Correct ?    19 Yes 14 No

How to add Primary key in DataSet..

Answer / tamilan

This is answer is great. its help me lot.


In eidt dataset designer right click on column name which u
want as primary key and set it as pk

Is This Answer Correct ?    6 Yes 5 No

How to add Primary key in DataSet..

Answer / rajesh bhawsar

dt.PrimaryKey = {dt.Columns(0)}

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More ADO.NET Interview Questions

What are different types of Commands available with DataAdapter ?

1 Answers   Arigo Infotech,


What is isolation?

0 Answers  


What is partial class?

0 Answers  


What is the difference between the clone() and copy() methods of the dataset class?

0 Answers  


What are disadvantages of microsoft-provided data provider classes in ado.net?

0 Answers  


Call a stored procedure from ado.net and pass parameter to it ?

7 Answers   Keane India Ltd, TCS,


What is ado.net components?

0 Answers  


What is the key feature of ADO.NET compared to ADO ?

3 Answers   TCS,


How do you find the count of records in a dataset?

0 Answers  


What are the important features of ado.net 2.0?

0 Answers  


What are all components of ADO.Net data provider?

0 Answers  


how to keep track of index in listbox items.

2 Answers  


Categories