You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
58 lines
2.4 KiB
58 lines
2.4 KiB
|
|
using System.Data;
|
|
using MySql.Data.MySqlClient;
|
|
|
|
namespace FangYar.Common
|
|
{
|
|
|
|
/// <summary>
|
|
/// SQL分页帮助类
|
|
/// </summary>
|
|
public class SqlPagerHelperOra
|
|
{
|
|
public static void Select(int pagesize, int curpage, out int totalcount, string tablename, string fields, string sqlWhere, string orderColumn, string orderStyle)
|
|
{
|
|
MySqlParameter[] parameters = {
|
|
new MySqlParameter("p_tableName", MySqlDbType.VarChar),
|
|
new MySqlParameter("p_strWhere", MySqlDbType.VarChar),
|
|
new MySqlParameter("p_orderColumn", MySqlDbType.VarChar),
|
|
new MySqlParameter("p_orderStyle", MySqlDbType.VarChar),
|
|
new MySqlParameter("p_curPage", MySqlDbType.Int32),
|
|
new MySqlParameter("p_pageSize", MySqlDbType.Int32),
|
|
new MySqlParameter("p_fields", MySqlDbType.VarChar),
|
|
new MySqlParameter("p_totalRecords", MySqlDbType.Int32),
|
|
new MySqlParameter("p_totalPages", MySqlDbType.Int32)};
|
|
//new MySqlParameter("v_cur",MySqlDbType.RefCursor)};
|
|
parameters[0].Direction = ParameterDirection.Input;
|
|
parameters[1].Direction = ParameterDirection.Input;
|
|
parameters[2].Direction = ParameterDirection.Input;
|
|
parameters[3].Direction = ParameterDirection.Input;
|
|
parameters[4].Direction = ParameterDirection.Input;
|
|
parameters[5].Direction = ParameterDirection.Input;
|
|
parameters[6].Direction = ParameterDirection.Input;
|
|
parameters[7].Direction = ParameterDirection.Output;
|
|
parameters[8].Direction = ParameterDirection.Output;
|
|
parameters[9].Direction = ParameterDirection.Output;
|
|
|
|
|
|
parameters[0].Value = tablename;
|
|
parameters[1].Value = sqlWhere;
|
|
parameters[2].Value = orderColumn;
|
|
parameters[3].Value = orderStyle;
|
|
parameters[4].Value = curpage;
|
|
parameters[5].Value = pagesize;
|
|
parameters[6].Value = fields;
|
|
|
|
DataSet ds = FangYar.Common.MySqlHelper.ExecuteProc("PCK_System.USP_GetRecordByPage", parameters);//执行存储过程获得DataSet
|
|
|
|
|
|
DataTable dt = ds.Tables[0];
|
|
|
|
|
|
//总共多少条数据
|
|
totalcount = int.Parse(parameters[7].Value.ToString());
|
|
|
|
}
|
|
|
|
}
|
|
}
|
|
|