Данные хранятся в наборе данных, но не могут связать данные
con = new SqlConnection(conn); con.Open(); DataSet ds = new DataSet(); // DataTable dt = new DataTable(); da = new SqlDataAdapter("SELECT cc.courseCATId ,cm.CourseName,cc.CourseCatName ,cc.CourseDur,cc.CourseFee FROM CourseCat cc INNER JOIN courseMaster cm ON cc.courseId =cm.courseId ORDER BY cc.courseId", con); da.Fill(ds); //MessageBox.Show(ds.Tables[0].Rows.Count.ToString() ); // dataGridView2.DataSource = null; dataGridView2.AutoGenerateColumns = false; dataGridView2.ColumnCount = 5; dataGridView2.Columns[0].Name = "Course catID"; dataGridView2.Columns[0].HeaderText = "Category ID"; dataGridView2.Columns[0].DataPropertyName = "cc.courseCATId"; dataGridView2.Columns[1].Name = "Course Name"; dataGridView2.Columns[1].HeaderText = "Course Name"; dataGridView2.Columns[1].DataPropertyName = "cm.CourseName"; dataGridView2.Columns[2].Name = "Course cat Name"; dataGridView2.Columns[2].HeaderText = "Category Name"; dataGridView2.Columns[2].DataPropertyName = "cc.CourseCatName"; dataGridView2.Columns[3].Name = "Course Duration"; dataGridView2.Columns[3].HeaderText = "Course Duration"; dataGridView2.Columns[3].DataPropertyName = "cc.CourseDur"; dataGridView2.Columns[4].Name = "Course Fee"; dataGridView2.Columns[4].HeaderText = "Course Fee"; dataGridView2.Columns[4].DataPropertyName = "cc.CourseFee"; dataGridView2.DataSource = ds; con.Close();
Что я уже пробовал:
data hold in data set but could not bind data