我在点1,2,3,4,5...下一页时,这些链接到前一页后一页的超链接数字没有了,很郁闷,不知道什么原因,帮看看吧,朋友。
主要在这里运行后,出问题:
- C# code
protected void myDataGrid_PageIndexChanging(object sender, GridViewPageEventArgs e) { this.myDataGrid.PageIndex = e.NewPageIndex; startIndex = myDataGrid.PageSize * this.myDataGrid.PageIndex; if(Session["RuleID"]!=null){ ruleID = (long)Session["RuleID"]; } startTime = DateTime.Parse(txStartTime.Text); endTime = DateTime.Parse(txEndTime.Text); EQID = ddToolList.Text; chamberID = lsChamberList.Text; DataSet alarmDataDS = GetChamberAlarmData(ruleID, startIndex, pageSize, EQID, chamberID, startTime, endTime); DataTable objTable = GetObjectTable(alarmDataDS); myDataGrid.DataSource = objTable; this.myDataGrid.DataBind(); for (int j = 0; j < myDataGrid.Rows.Count; j++) { myDataGrid.Rows[j].Cells[1].Text = string.Format("<a href='ByRaw.aspx?UpPage=RawData&RunID={0}'>{0}</a>", myDataGrid.Rows[j].Cells[1].Text); ; } }
如下代码也参考一下:
public DataSet GetAlarmData(long ruleID,int startIndex,int pageSize, string EQID, string chamberID, DateTime SDT, DateTime EDT)
{
string sqlText = @"SELECT Q.RUNID,Q.QTY FROM (SELECT T.RUNID,COUNT(*) AS QTY FROM ALARMHIST T WHERE
T.RULEID=:RuleID
AND T.EQID=:EqID
AND T.CHAMBERID=:ChamberID
AND T.DATETIME BETWEEN :StartT AND :EndT
GROUP BY T.RUNID)Q
ORDER BY Q.QTY DESC,Q.RUNID";
OracleCommand cmd = new Oracle.DataAccess.Client.OracleCommand(sqlText, summaryConn);
cmd.CommandType = System.Data.CommandType.Text;
cmd.Parameters.Add(new Oracle.DataAccess.Client.OracleParameter { ParameterName = "RuleID", DbType = System.Data.DbType.Decimal });
cmd.Parameters["RuleID"].Direction = System.Data.ParameterDirection.Input;
cmd.Parameters["RuleID"].Value = ruleID;
cmd.Parameters.Add(new Oracle.DataAccess.Client.OracleParameter { ParameterName = "EqID", DbType = System.Data.DbType.String });
cmd.Parameters["EqID"].Direction = System.Data.ParameterDirection.Input;
cmd.Parameters["EqID"].Value = EQID;
cmd.Parameters.Add(new Oracle.DataAccess.Client.OracleParameter { ParameterName = "ChamberID", DbType = System.Data.DbType.String });
cmd.Parameters["ChamberID"].Direction = System.Data.ParameterDirection.Input;
cmd.Parameters["ChamberID"].Value = chamberID;
cmd.Parameters.Add(new Oracle.DataAccess.Client.OracleParameter { ParameterName = "StartT", DbType = System.Data.DbType.DateTime });
cmd.Parameters["StartT"].Direction = System.Data.ParameterDirection.Input;
cmd.Parameters["StartT"].Value = SDT;
cmd.Parameters.Add(new Oracle.DataAccess.Client.OracleParameter { ParameterName = "EndT", DbType = System.Data.DbType.DateTime });
cmd.Parameters["EndT"].Direction = System.Data.ParameterDirection.Input;
cmd.Parameters["EndT"].Value = EDT;
DataSet ds;
ds = new DataSet();
OracleDataAdapter oraDataAdapter = new OracleDataAdapter(cmd);