我有一个gridview,我允许分页。 但当我点击第二页时,gridview消失了 这是c#代码:
protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
GridView1.PageIndex = e.NewPageIndex;
OdbcDataAdapter adpState = new OdbcDataAdapter("SELECT CALL_NO,TDATE,
ID_NO,NAME,CONTACT,DEPARTMENT,ISSUE,STATUS FROM TBL_ITHELPDESK
WHERE (STATUS IS NULL OR STATUS <> 'CLOSED') AND TDATE= TO_DATE('" +
txtDate.Text.ToString().Trim() + "','MM-DD-YYYY')", con1);
DataSet ds = new DataSet();
adpState.Fill(ds);
GridView1.DataSource = ds;
GridView1.DataBind();
}
任何人都可以帮忙找到我出错的地方
答案 0 :(得分:4)
你必须检查多件事。
在不在方法中的类中定义con1
,类似
odbcConnection con = new odbcConnection(ConectionString);