if @a_SelectWhere='' or @a_SelectWhere IS NULL select @TmpSelect = 'set nocount off;set rowcount 0;select '+@a_TableList+' from '+@a_TableName+' where '+@a_SelectOrderId+' between ' else select @TmpSelect = 'set nocount off;set rowcount 0;select '+@a_TableList+' from '+@a_TableName+' '+@a_SelectWhere+' and '+@a_SelectOrderId+' between '
if @intEndID > @intBeginID select @TmpSelect = @TmpSelect+'@SPintBeginID and @SPintEndID'+' '+@a_SelectOrder else select @TmpSelect = @TmpSelect+'@SPintEndID and @SPintBeginID'+' '+@a_SelectOrder
后台代码 using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using System.Data.SqlClient; using System.Text.RegularExpressions; public partial class cpjsq : System.Web.UI.Page { public int curPage = 1;//当前页 public int totalPage = 0;//总的页数 public static string item; protected void Page_Load(object sender, EventArgs e) { if(!Page.IsPostBack) { if (Request["item"] != null) { item = Request["item"].ToString(); } int intPageNo, intPageSize, intPageCount; intPageSize = 6;//OK!!!!! if (Request["CurrentPage"] == null) { intPageNo = 1; } else { intPageNo = Int32.Parse(Request["CurrentPage"]); } SqlConnection mySqlConnection = new SqlConnection(System.Configuration.ConfigurationSettings.AppSettings["BBB"]); SqlCommand mySqlCommand = new SqlCommand("up_GetTopicList", mySqlConnection); mySqlCommand.CommandType = CommandType.StoredProcedure;
//搜索条件,如"select * from aa where a=1 and b=2 and c=3"则条件为"where a=1 and b=2 and c=3" workParm = mySqlCommand.Parameters.Add("@a_SelectWhere", SqlDbType.VarChar, 500); mySqlCommand.Parameters["@a_SelectWhere"].Value = " where JS like '%" + item + "%'"; //mySqlCommand.Parameters["@a_SelectWhere"].Value = "where newsid <>'10000000'";