asp.net datalist控件数据绑定能用嵌套查询吗?
voidbindgrid2(){stringsqlconnstr=ConfigurationManager.ConnectionStrings["ConnectionSt...
void bindgrid2()
{
string sqlconnstr = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
DataSet ds = new DataSet();
using (SqlConnection sqlconn = new SqlConnection(sqlconnstr))
{
SqlDataAdapter sqld = new SqlDataAdapter("select * from Dynamic where focus in(select focus from Focus where id='" + s + "')order by time desc", sqlconn);
sqld.Fill(ds, "tabSpeech");
}
DataList2.DataSource = ds.Tables["tabDynamic"].DefaultView;
DataList2.DataBind();
}
编译没错误,但在datalist里面绑定数据的控件显示不出数据. 展开
{
string sqlconnstr = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
DataSet ds = new DataSet();
using (SqlConnection sqlconn = new SqlConnection(sqlconnstr))
{
SqlDataAdapter sqld = new SqlDataAdapter("select * from Dynamic where focus in(select focus from Focus where id='" + s + "')order by time desc", sqlconn);
sqld.Fill(ds, "tabSpeech");
}
DataList2.DataSource = ds.Tables["tabDynamic"].DefaultView;
DataList2.DataBind();
}
编译没错误,但在datalist里面绑定数据的控件显示不出数据. 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询