日期:2014-05-17 浏览次数:20557 次
public static SqlDataReader dataReader(string storedProcName, SqlParameter[] pars) { SqlCommand command = null; //using (SqlConnection connection = new SqlConnection(ConnectionString)) SqlConnection connection = new SqlConnection(ConnectionString); { connection.Open(); command = new SqlCommand(storedProcName, connection); if (pars != null) { command.Parameters.AddRange(pars); } } return command.ExecuteReader(CommandBehavior.CloseConnection); }
public SqlDataReader Pagerlist(FlysoPager Pager) { SqlParameter[] pars = new SqlParameter[9]; pars[0] = new SqlParameter("@sTable", SqlDbType.VarChar, 30); pars[0].Value = Pager.tablename; pars[1] = new SqlParameter("@sField", SqlDbType.VarChar, 200); pars[1].Value = Pager.Fields; pars[2] = new SqlParameter("@sCondition", SqlDbType.VarChar, 500); pars[2].Value = Pager.Condition; pars[3] = new SqlParameter("@sPkey", SqlDbType.VarChar, 150); pars[3].Value = Pager.MKey; pars[4] = new SqlParameter("@sOrder", SqlDbType.VarChar, 50); pars[4].Value = Pager.Order; pars[5] = new SqlParameter("@iPageCurr", SqlDbType.Int); pars[5].Value = Pager.intPageNo; pars[6] = new SqlParameter("@iPageSize", SqlDbType.Int); pars[6].Value = Pager.intPageSize; pars[7] = new SqlParameter("@iRecordCount", SqlDbType.Int); pars[7].Value = Pager.RecordCount; pars[8] = new SqlParameter("RowCount", SqlDbType.Int); pars[8].Direction = ParameterDirection.ReturnValue; return SqlHelper.dataReader("flyso_listpage",pars); }
. . . . Pager.RecordCount = new FlysoPager_DAL().TotalRecord(Pager); list.DataSource = new FlysoPager_DAL().Pagerlist(Pager); list.DataBind();