I have three tables course,faculty,student.I have implemented one to many relation between tables using primary key constraint & foreign key constraint.my design consists of one combobox & two datagridviews.I bind the common column of course table to combobox.when i select the combobox item it will display corresponding faculty table records in one gridvie & student table records in another gridview.these are in form load only.I get the result in C# Windows forms.given the code billow.but i am not getting same result in ASP.net.For this give asp.net full code.please use relations concept.
private void Form1_Load(object sender, EventArgs e)
{
string cs = "uid=sa;pwd=nanda;database=satyadatabase";
SqlConnection conn = new SqlConnection(cs);
// conn.Open();
SqlCommand cmd1 = new SqlCommand("select * from course", conn);
SqlCommand cmd2 = new SqlCommand("select * from faculty", conn);
SqlCommand cmd3 = new SqlCommand("select * from student", conn);
SqlDataAdapter da2 = new SqlDataAdapter(cmd);
SqlDataAdapter da1 = new SqlDataAdapter(cmd4);
SqlDataAdapter da3 = new SqlDataAdapter(cmd3);
DataSet ds = new DataSet();
da1.Fill(ds, "coursenew");
da2.Fill(ds, "facultynew");
da3.Fill(ds, "studentnew");
ds.Relations.Add("coursefac", ds.Tables["coursenew"].Columns["courseid"], ds.Tables["facultynew"].Columns["courseid"]);
ds.Relations.Add("coursest", ds.Tables["coursenew"].Columns["courseid"], ds.Tables["studentnew"].Columns["courseid"]);
comboucname.DataSource = ds.Tables["coursenew"];
comboucname.DisplayMember = "coursename";
gridfaculty.DataSource = ds.Tables["coursenew"];
gridfaculty.DataMember = "coursefac";
gridstudent.DataSource = ds.Tables["coursenew"];
gridstudent.DataMember = "coursest";
}
[edit]Tags only - OriginalGriff[/edit]