如果我想在和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();

}

}
}
展开
 我来答
lrw1018
2009-04-08
知道答主
回答量:3
采纳率:0%
帮助的人:0
展开全部
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;
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式