Quote:C# OledbConnection con = new OledbConnection("Connection String"); con.Open(); //Adding Primary Key OledbCommand comm = new OledbCommand("alter table Table1 add constraint pk_id primary key(id)",con); comm.ExecuteNonQuery(); //Adding Foriegn Key comm = new OledbCommand("alter table Table2 add constraint fk_id foreign key(id) references Table1(id)",con); comm.ExecuteNonQuery(); con.Close();
OledbConnection con = new OledbConnection("Connection String"); con.Open(); //Adding Primary Key OledbCommand comm = new OledbCommand("alter table Table1 add constraint pk_id primary key(id)",con); comm.ExecuteNonQuery(); //Adding Foriegn Key comm = new OledbCommand("alter table Table2 add constraint fk_id foreign key(id) references Table1(id)",con); comm.ExecuteNonQuery(); con.Close();
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)