如果我想在和DataList1同个界面中加个DataList2. 再将DataList2与WB_INFOPATH,接下来应该怎么写 20
如果我想在和DataList1同个界面中加个DataList2.再将DataList2与WB_INFOPATH,接下来应该怎么写,请写出来,谢谢,写好立马采纳((下面为我...
如果我想在和DataList1同个界面中加个DataList2. 再将DataList2与WB_INFOPATH,接下来应该怎么写,请写出来,谢谢,写好立马采纳((下面为我写好的将数据绑定在datelist1上的代码))
namespace website1
{
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
InfoLists();
}
public SqlConnection GetConnection()
{
SqlConnection thisConncetion = new SqlConnection(ConfigurationSettings.AppSettings["conn"]);
return thisConncetion;
}
public DataTable dt(string query)
{
//返回一个DataTable类型
SqlConnection thisConncetion = GetConnection();
thisConncetion.Open();
SqlDataAdapter adapter = new SqlDataAdapter(query, thisConncetion);
DataTable dt = new DataTable();
adapter.Fill(dt);
thisConncetion.Close();
return dt;
}
public void InfoLists()
{
DataList1.DataSource = dt("select * from wb_info ");
DataList1.DataBind();
}
}
} 展开
namespace website1
{
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
InfoLists();
}
public SqlConnection GetConnection()
{
SqlConnection thisConncetion = new SqlConnection(ConfigurationSettings.AppSettings["conn"]);
return thisConncetion;
}
public DataTable dt(string query)
{
//返回一个DataTable类型
SqlConnection thisConncetion = GetConnection();
thisConncetion.Open();
SqlDataAdapter adapter = new SqlDataAdapter(query, thisConncetion);
DataTable dt = new DataTable();
adapter.Fill(dt);
thisConncetion.Close();
return dt;
}
public void InfoLists()
{
DataList1.DataSource = dt("select * from wb_info ");
DataList1.DataBind();
}
}
} 展开
1个回答
展开全部
namespace website1
{
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
InfoLists();
}
public SqlConnection GetConnection()
{
SqlConnection thisConncetion = new SqlConnection(ConfigurationSettings.AppSettings["conn"]);
return thisConncetion;
}
public DataTable dt(string query)
{
//返回一个DataTable类型
SqlConnection thisConncetion = GetConnection();
thisConncetion.Open();
SqlDataAdapter adapter = new SqlDataAdapter(query, thisConncetion);
DataTable dt = new DataTable();
adapter.Fill(dt);
thisConncetion.Close();
return dt;
}
public void InfoLists()
{
DataList1.DataSource = dt("select * from wb_info ");
DataList1.DataBind();
}
}
SqlConnection thisConncetion = new SqlConnection(ConfigurationSettings.AppSettings["conn"]);
return thisConncetion;
}
public DataTable dt(string query)
SqlConnection thisConncetion = GetConnection();
thisConncetion.Open();
SqlDataAdapter adapter = new SqlDataAdapter(query, thisConncetion);
DataTable dt = new DataTable();
adapter.Fill(dt);
thisConncetion.Close();
return dt;
{
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
InfoLists();
}
public SqlConnection GetConnection()
{
SqlConnection thisConncetion = new SqlConnection(ConfigurationSettings.AppSettings["conn"]);
return thisConncetion;
}
public DataTable dt(string query)
{
//返回一个DataTable类型
SqlConnection thisConncetion = GetConnection();
thisConncetion.Open();
SqlDataAdapter adapter = new SqlDataAdapter(query, thisConncetion);
DataTable dt = new DataTable();
adapter.Fill(dt);
thisConncetion.Close();
return dt;
}
public void InfoLists()
{
DataList1.DataSource = dt("select * from wb_info ");
DataList1.DataBind();
}
}
SqlConnection thisConncetion = new SqlConnection(ConfigurationSettings.AppSettings["conn"]);
return thisConncetion;
}
public DataTable dt(string query)
SqlConnection thisConncetion = GetConnection();
thisConncetion.Open();
SqlDataAdapter adapter = new SqlDataAdapter(query, thisConncetion);
DataTable dt = new DataTable();
adapter.Fill(dt);
thisConncetion.Close();
return dt;
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询