all of the above you want to have the data in a dataset or datatable right. so pls do the following which should solve your problem
string cmd1 = "select course_id from course_teacher where teacher_id='" + Session["t_id"] + "'";
SqlDataAdapter da1 = new SqlDataAdapter(cmd1, con);
DataSet ds1 = new DataSet();
da1.Fill(ds1);
string cmd2 = "";
Datatable dt-new DataTable();
for (int i = 0; i < ds1.Tables[0].Rows.Count; i++)
{
int courseid = Convert.ToInt32(ds1.Tables[0].Rows[i]["course_id"].ToString());
cmd2 = "select (course_name+'-'+class_name)from courses where course_id='" + courseid + "'";
SqlDataAdapter da2 = new SqlDataAdapter(cmd2, con);
DataSet ds2 = new DataSet();
da2.Fill(ds2);
if(i=0)
{
dt=ds2.tables[0];
}
else
{
dt.merge(ds2.tables[0]);
}
}
DropDownList1.DataSource = dt;
DropDownList1.DataBind();
and i am sure it will solve your problem.....