How to add Primary key in DataSet
Answers were Sorted based on User's Feedback
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 |
Answer / gopi
ds.Tables[0].Constraints.Add("pk_sid",
ds.Tables[0].Columns[0], true);
| Is This Answer Correct ? | 29 Yes | 4 No |
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 |
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 |
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 |
What are the two fundamental objects in ADO.NET?
Explain different methods and Properties of DataReader which you have used in your project?
What is ado.net connection?
Execute nonquery returns no. of afected rows.So if my stored procedure hav lot of select stmnt, delete stmnt, insert stmnt..then what does execute nonquery returns in this case?
What are the different row versions available in table?
Difference between function and trigger?
Explain the various objects in dataset.
describe the dataset object in ado.net.
What is different between sqlcommand object and command behavior object?
What are the namespaces used in ado.net for data access?
Define the data provider classes that is supported by ado.net?
what is execute scalar?
11 Answers Atharva Infotech, Dohatec New Media, Make eIT, Protech,
Visual Basic (800)
C Sharp (3816)
ASP.NET (3180)
VB.NET (461)
COM+ (79)
ADO.NET (717)
IIS (369)
MTS (11)
Crystal Reports (81)
BizTalk (89)
Dot Net (2435)
Exchange Server (362)
SharePoint (720)
WCF (340)
MS Office Microsoft (6963)
LINQ Language-Integrated Query (317)
WPF (371)
TypeScript (144)
Microsoft Related AllOther (311)