名为"Table1"的 DataTable 已属于此 DataSet
publicvoidPage_Load(){DataSetds=newDataSet();DataTabledt=LoadNews().Copy();DataTabled...
public void Page_Load()
{
DataSet ds = new DataSet();
DataTable dt = LoadNews().Copy();
DataTable dt1 = LoadUser().Copy();
ds.Tables.Add(dt);
ds.Tables.Add(dt1);
gvInfo.DataSource = ds.Tables[0];
gvInfo.DataBind();
}
public DataTable LoadNews()
{
string sql = "select * from News";
SqlDataAdapter adapter = new SqlDataAdapter(sql, dbHelper.Connection);
DataTable dt = new DataTable();
adapter.Fill(dt);
return dbHelper.MyFillByDataTable(sql);
}
public DataTable LoadUser()
{
string sql = "select * from BASE_User";
SqlDataAdapter adapter = new SqlDataAdapter(sql, dbHelper.Connection);
DataTable dt = new DataTable();
adapter.Fill(dt);
return dbHelper.MyFillByDataTable(sql);
}
这样就会出现如题的错误。是不是要在DataTable哪个地方改表名? 展开
{
DataSet ds = new DataSet();
DataTable dt = LoadNews().Copy();
DataTable dt1 = LoadUser().Copy();
ds.Tables.Add(dt);
ds.Tables.Add(dt1);
gvInfo.DataSource = ds.Tables[0];
gvInfo.DataBind();
}
public DataTable LoadNews()
{
string sql = "select * from News";
SqlDataAdapter adapter = new SqlDataAdapter(sql, dbHelper.Connection);
DataTable dt = new DataTable();
adapter.Fill(dt);
return dbHelper.MyFillByDataTable(sql);
}
public DataTable LoadUser()
{
string sql = "select * from BASE_User";
SqlDataAdapter adapter = new SqlDataAdapter(sql, dbHelper.Connection);
DataTable dt = new DataTable();
adapter.Fill(dt);
return dbHelper.MyFillByDataTable(sql);
}
这样就会出现如题的错误。是不是要在DataTable哪个地方改表名? 展开
2个回答
2014-04-05
展开全部
给每个表加上名称试看
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询