Asp.net| program | stored Procedure | paging
The stored procedure is changed from the Bigeagle forum paging program. Please criticize! :)
Select.aspx
--------------------------------------------------------------------------------
SqlConnection mysqlconnection = new SqlConnection ("server= (local);D atabase=test;user id=sa;password=");
SqlCommand Mysqlcommand = new SqlCommand ("Up_gettopiclist", mysqlconnection);
Mysqlcommand.commandtype = CommandType.StoredProcedure;
SqlParameter Workparm;
Search for table fields, separated by ","
Workparm = MySqlCommand.Parameters.Add ("@a_TableList", SqlDbType.VarChar, 200);
mysqlcommand.parameters["@a_TableList"]. Value = "Offerid,type,offertime";
Search Table Name
Workparm = MySqlCommand.Parameters.Add ("@a_TableName", SqlDbType.VarChar, 30);
mysqlcommand.parameters["@a_TableName"]. Value = "Offer";
Search criteria, such as "select * from AA where a=1 and b=2 and c=3", the condition is "where a=1 and b=2 and C=3"
Workparm = MySqlCommand.Parameters.Add ("@a_SelectWhere", SqlDbType.VarChar, 500);
mysqlcommand.parameters["@a_SelectWhere"]. Value = "where type= ' idl '";
Table primary key field name, must be int type
Workparm = MySqlCommand.Parameters.Add ("@a_SelectOrderId", SqlDbType.VarChar, 50);
mysqlcommand.parameters["@a_SelectOrderId"]. Value = "OfferID";
Sort, you can sort with multiple fields but the primary key fields must be in the front
Workparm = MySqlCommand.Parameters.Add ("@a_SelectOrder", SqlDbType.VarChar, 50);
mysqlcommand.parameters["@a_SelectOrder"]. Value = "ORDER by OfferID Desc";
Page number
Workparm = MySqlCommand.Parameters.Add ("@a_intPageNo", SqlDbType.Int);
mysqlcommand.parameters["@a_intPageNo"]. Value = Intpageno;
Display number per page
Workparm = MySqlCommand.Parameters.Add ("@a_intPageSize", SqlDbType.Int);
mysqlcommand.parameters["@a_intPageSize"]. Value = intpagesize;
Total number of records (stored procedure output parameters)
Workparm = MySqlCommand.Parameters.Add ("@RecordCount", SqlDbType.Int);
Workparm.direction = ParameterDirection.Output;
Number of current page records (stored procedure return value)
Workparm = MYSQLCOMMAND.PARAMETERS.ADD ("RowCount", SqlDbType.Int);
Workparm.direction = ParameterDirection.ReturnValue;
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.