public List SelectMySqlBaseInfoByProc(int pageIndex, int pageSize, string sqlWhere, out int rowCount, out int pageCount)
{
rowCount = 0;
pageCount = 0;
MySqlConnection mysqlcon;
MySqlDataAdapter mysqldata = new MySqlDataAdapter();
DataSet dataset = new DataSet();
mysqlcon = new MySqlConnection(connectionString);
mysqldata.SelectCommand = new MySqlCommand();
mysqldata.SelectCommand.Connection = mysqlcon;
mysqldata.SelectCommand.CommandText = "Query_Pagination";
mysqldata.SelectCommand.CommandType = CommandType.StoredProcedure;
//设置参数,添加到数据库
MySqlParameter table_parameter = new MySqlParameter("@$TableName", MySqlDbType.VarChar, 200);//mysql的存储过程参数是以?打头的!!!!
table_parameter.Value = "t_opinion_baseinfo";
mysqldata.SelectCommand.Parameters.Add(table_parameter);
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
MySqlParameter fieldList_parameter = new MySqlParameter("@$FieldList", MySqlDbType.VarChar, 2000);//mysql的存储过程参数是以?打头的!!!!
fieldList_parameter.Value = "*";
mysqldata.SelectCommand.Parameters.Add(fieldList_parameter);
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
MySqlParameter primaryKey_parameter = new MySqlParameter("@$PrimaryKey", MySqlDbType.VarChar, 100);//mysql的存储过程参数是以?打头的!!!!
primaryKey_parameter.Value = "ID";
mysqldata.SelectCommand.Parameters.Add(primaryKey_parameter);
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
MySqlParameter where_parameter = new MySqlParameter("@$Where", MySqlDbType.VarChar, 1000);//mysql的存储过程参数是以?打头的!!!!
where_parameter.Value = sqlWhere;
mysqldata.SelectCommand.Parameters.Add(where_parameter);
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
MySqlParameter order_parameter = new MySqlParameter("@$Order", MySqlDbType.VarChar, 1000);//mysql的存储过程参数是以?打头的!!!!
order_parameter.Value = "FindTime";
mysqldata.SelectCommand.Parameters.Add(order_parameter);
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
MySqlParameter sortType_parameter = new MySqlParameter("@$SortType", MySqlDbType.Int32,100);//mysql的存储过程参数是以?打头的!!!!
sortType_parameter.Value = 2;
mysqldata.SelectCommand.Parameters.Add(sortType_parameter);
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
MySqlParameter recorderCount_parameter = new MySqlParameter("@$RecorderCount", MySqlDbType.Int32, 100);//mysql的存储过程参数是以?打头的!!!!
recorderCount_parameter.Value = 0;
mysqldata.SelectCommand.Parameters.Add(recorderCount_parameter);
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
MySqlParameter pageSize_parameter = new MySqlParameter("@$PageSize", MySqlDbType.Int32, 100);//mysql的存储过程参数是以?打头的!!!!
pageSize_parameter.Value = pageSize;
mysqldata.SelectCommand.Parameters.Add(pageSize_parameter);
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
MySqlParameter pageIndex_parameter = new MySqlParameter("@$PageIndex", MySqlDbType.Int32, 100);//mysql的存储过程参数是以?打头的!!!!
pageIndex_parameter.Value = pageIndex;
mysqldata.SelectCommand.Parameters.Add(pageIndex_parameter);
//++++++++++++++++++++++++++返回值++++++++++++++++++++++++++++++++++++++++++
MySqlParameter totalCount_parameter = new MySqlParameter("@$TotalCount", MySqlDbType.Int32, 100);//mysql的存储过程参数是以?打头的!!!!
totalCount_parameter.Direction = ParameterDirection.Output;
mysqldata.SelectCommand.Parameters.Add(totalCount_parameter);
//++++++++++++++++++++++++++返回值++++++++++++++++++++++++++++++++++++++++++
MySqlParameter totalPageCount_parameter = new MySqlParameter("@$TotalPageCount", MySqlDbType.Int32, 100);//mysql的存储过程参数是以?打头的!!!!
totalPageCount_parameter.Direction = ParameterDirection.Output;
mysqldata.SelectCommand.Parameters.Add(totalPageCount_parameter);
//+++++++++++++++++++++++++打开数据库,插入数据,返回id值+++++++++++++++++++
try
{
mysqldata.Fill(dataset);
object id = totalCount_parameter.Value;
object id2 = totalPageCount_parameter.Value;
rowCount = (Int32)id;
pageCount = (Int32)id2;
}
catch (MySqlException e)
{
}
return ConvertDataSetToList.Convert(dataset, 0);
}