发布网友 发布时间:1小时前
共2个回答
热心网友 时间:1小时前
你没有运行你写的SQL,DataSet是空的。
try
{
SqlConnection conn = new SqlConnection("server=.;database=WebCourseSettlement;uid=sa;password=;");
conn.Open();
String strcmd = String strcmd = "select COURSE_NAME,TEACHER_NAME,ClassName from selectkechengbiao where StudentGroup_ids=" + groupId;
SqlDataAdapter da = new SqlDataAdapter(strcmd, conn);
SqlCommand cmd = new SqlCommand(strcmd, conn);
int flag = cmd.ExecuteNonQuery();
DataSet ds = new DataSet();
da.Fill(ds, "SELECT");
GridView1.DataSource = ds;
GridView1.DataBind();
conn.Close();
}
catch (Exception ex)
{
Response.Write(ex.ToString());
}
热心网友 时间:1小时前
StudentGroup_ids='" + groupId + "'";
StudentGroup_ids是字符串吧?
你的视图直接能打开查看数据吗?