I need to bind two tables into a dataset. I have three table named, Students, StudentMarks.
Here if I know the studentId I can query the student table like
DataSet ds=new DataSet();
SqlCommand cmd=new SqlCommand("
SELECT *
FROM STUDENTS
WHERE STUDENTID=1;
SELECT *
FROM STUDENTS
WHERE STUDENTID=1");
SqlDataAdapter da=new SqlDataAdapter(cmd);
da.Fill(ds);
like this. So that I can access these two tables like ds.Table[0] and ds.Table[1].
But my question is, if I dont know the studentid and if I want to query all the students as well as their marks and I’ve to get these details in two different tables how can I get?
If I join these two tables, the result will be in a single table, I dunno how to do this, can anyone help me out here? thanks in advance.
Try this;