求修改啊,不知道怎么回事啊
usingSystem;usingSystem.Collections.Generic;usingSystem.Linq;usingSystem.Web;usingSys...
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Data;
public partial class iesearch : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
public void dlBind(string sqlstr, string table, string dkf)
{
int curpage = Convert.ToInt32(this.labPage.Text);
PagedDataSource ps = new PagedDataSource();
SqlConnection sqlconn = new SqlConnection();
sqlconn.Open();
SqlDataAdapter MyAdapter = new SqlDataAdapter(sqlstr, sqlconn);
DataSet ds = new DataSet();
MyAdapter.Fill(ds, table);
ps.DataSource = ds.Tables[table].DefaultView;
ps.AllowPaging = true;
ps.PageSize = 5;
ps.CurrentPageIndex = curpage - 1;
this.lnkbtnUp.Enabled = true;
this.lnkbtnNext.Enabled = true;
this.lnkbtnBack.Enabled = true;
this.lnkbtnOne.Enabled = true;
if (curpage == 1)
{
this.lnkbtnOne.Enabled = false;
this.lnkbtnUp.Enabled = false;
}
if (curpage == ps.PageCount)
{
this.lnkbtnNext.Enabled = false;
this.lnkbtnBack.Enabled = false;
}
this.labBackPage.Text = Convert.ToString(ps.PageCount);
this.dlInfo.DataSource = ps;
this.dlInfo.DataKeyField = dkf;
this.dlInfo.DataBind();
}
public void dlInfoBind()
{
if (ddlInfoType.Visible == false)
{
string sqlstr = "select*from tb-Info where" + ddlSCondition.SelectedValue.Trim()
+ "" + ddlSSign.SelectedValue.Trim() + "'%" + "%'";
if (!sqloperate.comBind(sqlstr))
{
Response.Write("<script>alert('没有您要查询的结果,请重新输入')</script>");
txtSKWord.Text = "";
txtSKWord.Focus();
}
else
{
this.dlDataSind(sqlstr, "tb-Info", "InfoID");
}
}
else
{
string sqlstr = "select*from tb-Info where" + ddlSCondition.SelectedValue.Trim()
+ "" + ddlSSign.SelectedValue.Trim() + "'%" + ddlInfoType.SelectValue.Trim() + "%'";
if (!sqloperate.comBind(sqlstr))
{
Response.Write("<script>alert('没有您要查询的结果,请重新输入')</script>");
txtSKWord.Text = "";
txtSKWord.Focus();
}
else
{
this.dlDataBind(sqlstr, "tb-Info", "InfoID");
}
}
}
protected void btnSearch_Click(object sender, EventArgs e)
{
this.dlInfoBind();
}
}
一个站内搜索引擎,连接SQL数据库的,用的是C# 展开
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Data;
public partial class iesearch : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
public void dlBind(string sqlstr, string table, string dkf)
{
int curpage = Convert.ToInt32(this.labPage.Text);
PagedDataSource ps = new PagedDataSource();
SqlConnection sqlconn = new SqlConnection();
sqlconn.Open();
SqlDataAdapter MyAdapter = new SqlDataAdapter(sqlstr, sqlconn);
DataSet ds = new DataSet();
MyAdapter.Fill(ds, table);
ps.DataSource = ds.Tables[table].DefaultView;
ps.AllowPaging = true;
ps.PageSize = 5;
ps.CurrentPageIndex = curpage - 1;
this.lnkbtnUp.Enabled = true;
this.lnkbtnNext.Enabled = true;
this.lnkbtnBack.Enabled = true;
this.lnkbtnOne.Enabled = true;
if (curpage == 1)
{
this.lnkbtnOne.Enabled = false;
this.lnkbtnUp.Enabled = false;
}
if (curpage == ps.PageCount)
{
this.lnkbtnNext.Enabled = false;
this.lnkbtnBack.Enabled = false;
}
this.labBackPage.Text = Convert.ToString(ps.PageCount);
this.dlInfo.DataSource = ps;
this.dlInfo.DataKeyField = dkf;
this.dlInfo.DataBind();
}
public void dlInfoBind()
{
if (ddlInfoType.Visible == false)
{
string sqlstr = "select*from tb-Info where" + ddlSCondition.SelectedValue.Trim()
+ "" + ddlSSign.SelectedValue.Trim() + "'%" + "%'";
if (!sqloperate.comBind(sqlstr))
{
Response.Write("<script>alert('没有您要查询的结果,请重新输入')</script>");
txtSKWord.Text = "";
txtSKWord.Focus();
}
else
{
this.dlDataSind(sqlstr, "tb-Info", "InfoID");
}
}
else
{
string sqlstr = "select*from tb-Info where" + ddlSCondition.SelectedValue.Trim()
+ "" + ddlSSign.SelectedValue.Trim() + "'%" + ddlInfoType.SelectValue.Trim() + "%'";
if (!sqloperate.comBind(sqlstr))
{
Response.Write("<script>alert('没有您要查询的结果,请重新输入')</script>");
txtSKWord.Text = "";
txtSKWord.Focus();
}
else
{
this.dlDataBind(sqlstr, "tb-Info", "InfoID");
}
}
}
protected void btnSearch_Click(object sender, EventArgs e)
{
this.dlInfoBind();
}
}
一个站内搜索引擎,连接SQL数据库的,用的是C# 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询