ASP.NET结合存储过程写的通用搜索分页程序
存储过程改自bigeagle的论坛分页程序。请大家批判!:)
select.aspx
--------------------------------------------------------------------------------
<%@ Page Language="C#" %>
<%@ import Namespace="System.Data" %>
<%@ import Namespace="System.Data.SqlClient" %>
<script runat="server">
protected void Page_Load(Object sender, EventArgs e)
{
int intPageNo,intPageSize,intPageCount;
intPageSize = 25;
if (Request["CurrentPage"]==null)
{
intPageNo = 1;
}
else
{
intPageNo = Int32.Parse(Request["CurrentPage"]);
}
SqlConnection MySQL(和PHP搭配之最佳组合)Connection = new SqlConnection("server=(local);Database=test;user id=sa;password=");
SqlCommand MySQL(和PHP搭配之最佳组合)Command = new SqlCommand("up_GetTopicList", MySQL(和PHP搭配之最佳组合)Connection);
MySQL(和PHP搭配之最佳组合)Command.CommandType = CommandType.StoredProcedure;
SqlParameter workParm;
//搜索表字段,以","号分隔
workParm = MySQL(和PHP搭配之最佳组合)Command.Parameters.Add("@a_TableList", SqlDbType.VarChar, 200);
MySQL(和PHP搭配之最佳组合)Command.Parameters["@a_TableList"].Value = "OFFERID,type,offertime";
//搜索表名
workParm = MySQL(和PHP搭配之最佳组合)Command.Parameters.Add("@a_TableName", SqlDbType.VarChar, 30);