无法找到表 0。
News_Class代码
JWsql Exc_sql = new JWsql();
public string JWID = HttpContext.Current.Request[ "JWID "];
public string classname = " ";
protected void Page_Load(object sender, EventArgs e)
{
JW_FC.Check_num(JWID);
Exc_sql.Open();
string sql1 = "select JWClassName from JWNewsClass where JWID= " + JWID;
SqlDataReader dr1 = Exc_sql.Re_dr(sql1);
if (dr1.Read())
{
classname = "—— " + dr1[0].ToString();
}
dr1.Close();
Exc_sql.Close();
if (!IsPostBack)
{
bind();
}
}
private void bind()
{
try
{
string sql = " ";
Exc_sql.Open();
sql = "select * from JWNews where JWNewsClass in ( " + ChangHope_DB.JWParentPath(Convert.ToInt16(JWID), "JWNewsClass ") + ") and JWNewsSH=1 order by JWStat2=1,JWStat3=1,YJWID desc ";
ChangHope_DB Chp = new ChangHope_DB();
DataSet ds = Chp.Db_ds(sql, "JWNews ");
this.dg1.DataSource = datalistbind(ds);
this.dg1.DataBind();
}
catch (Exception ee)
{
Response.Write(ee.Message);
}
finally
{
Exc_sql.Close();
}
}
private PagedDataSource datalistbind(DataSet dst)
{
PagedDataSource objpage = new PagedDataSource();
objpage.DataSource = dst.Tables[0].DefaultView;
objpage.AllowPaging = true;
objpage.PageSize = 13;
int CurPage;
if (Request[ "iPage "] != null)
{
CurPage = Convert.ToInt32(Request[ "iPage "]);
}
else
{
CurPage = 1;
}
objpage.CurrentPageIndex = CurPage - 1;
Label1.Text = "第 " + CurPage.ToString() + "/ " + objpage.PageCount + "页 ";
Label2.Text = "共 " + objpage.DataSourceCount + "条 " + objpage.PageSize + "/页 ";
if (!objpage.IsFirstPage)
{
this.prev.NavigateUrl = Request.CurrentExecutionFilePath + "?iPage= " + (Convert.ToInt32(CurPage) - 1) + "&JWID= " + Request.QueryString[ "JWID "]; ;
}
this.start.NavigateUrl = Request.CurrentExecutionFilePath + "?iPage=1 " + "&JWID= " + Request.QueryString[ "JWID "]; ;
if (!objpage.IsLastPage)
{
this.next.NavigateUrl = Request.CurrentExecutionFilePath + "?ipage= " + (Convert.ToInt32(CurPage) + 1) + "&JWID= " + Request.QueryString[ "JWID "]; ;
}
this.max.NavigateUrl = Request.CurrentExecutionFilePath + "?iPage= " + objpage.PageCount + "&JWID= " + Request.QueryString[ "JWID "];
if (!IsPostBack)
{
for (int i = 1; i < objpage.PageCount + 1; i++)
{
this.iPage.Items.Add(new ListItem(i.ToString() + "页 ", i.ToString()));
}
}
return objpage;
}
public string Ret_stat(int bs, string str)
{
string str_name = " ";
if (bs == 1)
{
str_name = " <span style= 'color:red '> " + str + " </span> ";
}
return str_name;
}
protected void sic(object sender, EventArgs e)
{
string sql = " ";
sql = "select * from JWNews where JWNewsClass in ( " + ChangHope_DB.JWParentPath(Convert.ToInt16(JWID), "JWNewsClass ") + ") and JWNewsSH=1 order by JWStat2=1,JWStat3=1,JWID Asc ";
ChangHope_DB Chp = new ChangHope_DB();
DataSet ds = Chp.Db_ds(sql, "temp2 ");
PagedDataSource objpage = new PagedDataSource();
objpage.DataSource = ds.Tables[0].DefaultView;
objpage.AllowPaging = true;
objpage.PageSize = 20;
int CurPage;
if (iPage.SelectedValue != null)
{
CurPage = Convert.ToInt32(iPage.SelectedValue);
}
else
{
CurPage = 1;
}
objpage.CurrentPageIndex = CurPage - 1;
Label1.Text = "当前页:第 " + CurPage.ToString() + "/ " + objpage.PageCount + "页 ";
Label2.Text = "共有 " + objpage.DataSourceCount + "条记录 " + objpage.PageSize + "/页 ";
if (!objpage.IsFirstPage)
{
this.prev.NavigateUrl = Request.CurrentExecutionFilePath + "?iPage= " + (Convert.ToInt32(CurPage) - 1) + "&JWID= " + JWID;
}
this.start.NavigateUrl = Request.CurrentExecutionFilePath + "?iPage=1&JWID= " + Request.QueryString[ "JWID "]; ;
if (!objpage.IsLastPage)
{
this.next.NavigateUrl = Request.CurrentExecutionFilePath + "?ipage= " + (Convert.ToInt32(CurPage) + 1) + "&JWID= " + JWID;
}
this.max.NavigateUrl = Request.CurrentExecutionFilePath + "?iPage= " + objpage.PageCount + "&JWID= " + JWID;
if (!IsPostBack)
{
for (int i = 1; i < objpage.PageCount + 1; i++)
{
this.iPage.Items.Add(new ListItem(i.ToString() + "页 ", i.ToString()));
}
}
this.dg1.DataSource = objpage;
this.dg1.DataBind();
}
大家看看哪里有错
[解决办法]
呵呵,我素火火,接分鸟.