D
dajiangxu
Unregistered / Unconfirmed
GUEST, unregistred user!
是一个asp.net分页显示的问题,不能显示下一页,请帮我看看怎么回事?希望精通.net的人帮我看看,谢谢!<br>private void Page_Load(object sender, System.EventArgs e)<br> {<br> if(!IsPostBack)<br> {<br> getList();<br> }<br> }<br><br>private bool ExecProc()<br> {<br> SqlConnection cn1=new SqlConnection(ConfigurationSettings.AppSettings["ds"]);<br> SqlCommand cm1=new SqlCommand("P_TmpSubmit",cn1);<br> cm1.CommandType=CommandType.StoredProcedure;<br> SqlParameter SqlPam;<br> SqlPam=cm1.Parameters.Add(new SqlParameter("@DealOffice",SqlDbType.Char,10));<br> SqlPam.Value=Session["type"].ToString();<br> try<br> {<br> cn1.Open();<br> cm1.ExecuteNonQuery();<br> }<br> catch<br> {<br> return false;<br> }<br> finally<br> {<br> cm1.Dispose();<br> cn1.Close();<br> cn1.Dispose();<br> }<br> return true;<br> }<br><br> private void getList()<br> {<br> if (!ExecProc())<br> {<br> Response.Write(@"<script>alert('信访检索错误-00,请联系联动办或者确认服务器状态!');</script>"<br> return;<br> }<br> SqlConnection cn=new SqlConnection(ConfigurationSettings.AppSettings["ds"]);<br> string strSQL="select (nyear+Number) as PK,Number,nyear,PDateTime,RepName,EpName,NBPS,ZYXF from T_TmpSubmit";<br> SqlDataAdapter da=new SqlDataAdapter(strSQL,cn);<br> try<br> {<br> cn.Open();<br> DataSet ds=new DataSet();<br> da.Fill(ds);<br> DataGrid1.DataSource=ds;<br> DataGrid1.DataKeyField="PK";<br> if(ds.Tables[0].Rows.Count>0)<br> {<br> DataGrid1.ShowFooter=false;<br> }<br> else<br> {<br> DataGrid1.ShowFooter=true;<br> }<br> DataGrid1.DataBind();<br> ds.Clear();<br> ds.Dispose();<br> }<br> catch<br> {<br> Response.Write(@"<script>alert('信访检索错误-01,请联系联动办或者确认服务器状态!');</script>"<br> return;<br> }<br><br><br> finally<br> {<br> da.Dispose();<br> cn.Close();<br> cn.Dispose();<br> }<br> }<br><br>private void DataGrid1_PageIndexChanged(object source, System.Web.UI.WebControls.DataGridPageChangedEventArgs e) <br> {<br> DataGrid1.CurrentPageIndex=e.NewPageIndex;<br> getList();<br> }