| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1044 人关注过本帖
标题:搜索控件模块源代码
只看楼主 加入收藏
bavfhpdn66
Rank: 1
等 级:新手上路
威 望:1
帖 子:72
专家分:0
注 册:2007-4-11
收藏
 问题点数:0 回复次数:5 
搜索控件模块源代码
图片附件: 游客没有浏览图片的权限,请 登录注册

请问哪位高手有这种查询控件的源代码?

谢谢!
搜索更多相关主题的帖子: 源代码 模块 控件 搜索 
2007-05-06 21:25
川流不息
Rank: 6Rank: 6
等 级:贵宾
威 望:27
帖 子:2000
专家分:47
注 册:2006-11-8
收藏
得分:0 
什麼意思?查詢什麼?上網查詢旅游線路?

日月更替,天地輪回,人間已是幾回春。 江山不老,人正少年,只手能擎半邊天。
2007-05-06 21:41
moderndai
Rank: 1
等 级:新手上路
帖 子:104
专家分:0
注 册:2006-1-25
收藏
得分:0 
select 语句,先把你想的写出来,再来问,什么不都写谁知道是什么意思

ROCK AND ROCK PROGRAMING dai--yl@&&espricle@
2007-05-06 22:00
bavfhpdn66
Rank: 1
等 级:新手上路
威 望:1
帖 子:72
专家分:0
注 册:2007-4-11
收藏
得分:0 

这段是查询控件代码
protected void BtnSearch_Click(object sender, EventArgs e)
{
if (this.txtstart.Text==""&&this.txtwhither.Text=="")
{
this.Response.Write("不能为空!");
}
else
{
this.Response.Redirect(showmessage.aspx?UID=this.txtstart&DestD=this.txtwhither);
}

}

下面这段是查询结果显示代码:

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.Data;

public partial class showmessage : System.Web.UI.Page
{
SqlOperate sqloperate = new SqlOperate();
SqlConnection sqlconn = new SqlConnection(ConfigurationManager.AppSettings["constr"]);

protected void Page_Load(object sender, EventArgs e)
{
if (!this.IsPostBack)
{
string sqlstr = "select * from tb_Wuliu";
this.dlDataBind(sqlstr, "tb_Wuliu", "id");
}
}
protected void btnSearch_Click(object sender, EventArgs e)
{
this.dlInfoBind();
}
protected void lnkbtnOne_Click(object sender, EventArgs e)
{
this.labPage.Text = "1";
this.dlInfoBind();
}
protected void lnkbtnUp_Click(object sender, EventArgs e)
{
this.labPage.Text = Convert.ToString(Convert.ToInt32(this.labPage.Text) - 1);
this.dlInfoBind();
}
protected void lnkbtnNext_Click(object sender, EventArgs e)
{
this.labPage.Text = Convert.ToString(Convert.ToInt32(this.labPage.Text) + 1);
this.dlInfoBind();
}
protected void lnkbtnBack_Click(object sender, EventArgs e)
{
this.labPage.Text = this.labBackPage.Text;
this.dlInfoBind();
}
public void dlDataBind(string sqlstr, string table, string dkf)
{
int curpage = Convert.ToInt32(this.labPage.Text);
PagedDataSource ps = new PagedDataSource();
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()
{
String sqlstr = "select * from tb_Wuliu where UID='" + this.Request["Price"].ToString() + "'and where='" + this.Request["CompanyName"].ToString() + "'and where='"+ this.Request["Linkman"].ToString() +"'and where='"+ this.Request["Tel"].ToString() +"'";
//this.SQLDataRead

}
}
帮我看看编程思想有没有出错?
谢谢!


奋起直追,犹未晚也!
2007-05-06 22:05
tel1982
Rank: 3Rank: 3
来 自:水星
等 级:新手上路
威 望:8
帖 子:852
专家分:0
注 册:2006-10-21
收藏
得分:0 
以下是引用bavfhpdn66在2007-5-6 22:05:37的发言:

这段是查询控件代码
protected void BtnSearch_Click(object sender, EventArgs e)
{
if (this.txtstart.Text==""&&this.txtwhither.Text=="")
{
this.Response.Write("不能为空!");
}
else
{
this.Response.Redirect(showmessage.aspx?UID=this.txtstart&DestD=this.txtwhither);
}

}

下面这段是查询结果显示代码:

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.Data;

public partial class showmessage : System.Web.UI.Page
{
SqlOperate sqloperate = new SqlOperate();
SqlConnection sqlconn = new SqlConnection(ConfigurationManager.AppSettings["constr"]);

protected void Page_Load(object sender, EventArgs e)
{
if (!this.IsPostBack)
{
string sqlstr = "select * from tb_Wuliu";
this.dlDataBind(sqlstr, "tb_Wuliu", "id");
}
}
protected void btnSearch_Click(object sender, EventArgs e)
{
this.dlInfoBind();
}
protected void lnkbtnOne_Click(object sender, EventArgs e)
{
this.labPage.Text = "1";
this.dlInfoBind();
}
protected void lnkbtnUp_Click(object sender, EventArgs e)
{
this.labPage.Text = Convert.ToString(Convert.ToInt32(this.labPage.Text) - 1);
this.dlInfoBind();
}
protected void lnkbtnNext_Click(object sender, EventArgs e)
{
this.labPage.Text = Convert.ToString(Convert.ToInt32(this.labPage.Text) + 1);
this.dlInfoBind();
}
protected void lnkbtnBack_Click(object sender, EventArgs e)
{
this.labPage.Text = this.labBackPage.Text;
this.dlInfoBind();
}
public void dlDataBind(string sqlstr, string table, string dkf)
{
int curpage = Convert.ToInt32(this.labPage.Text);
PagedDataSource ps = new PagedDataSource();
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()
{
String sqlstr = "select * from tb_Wuliu where UID='" + this.Request["Price"].ToString() + "'and where='" + this.Request["CompanyName"].ToString() + "'and where='"+ this.Request["Linkman"].ToString() +"'and where='"+ this.Request["Tel"].ToString() +"'";
//this.SQLDataRead

}
}
帮我看看编程思想有没有出错?
谢谢!

看看是不是这里的问题。


Face up to life with smiles no matter what happens
2007-05-07 10:20
bavfhpdn66
Rank: 1
等 级:新手上路
威 望:1
帖 子:72
专家分:0
注 册:2007-4-11
收藏
得分:0 

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;

public partial class search : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{

}
private void fillDg()
{
this.GridView1.DataSource = wayoperater.creatercon();
this.GridView1.DataBind();
}
protected void btnsearch_Click(object sender, EventArgs e)
{
string condition ="";
condition = "1=1";
if (this.ckbstart.Checked)
{
condition = "Start=" + this.txtstart.Text;

}
else
{
condition = "Start like '%'";
}
if (this.ckbwhither.Checked)
{
condition += " and Whither like '%" + this.txtwhither.Text + "%'";
}
DataView dv = new DataView(wayoperater.selectAlltb_Way());
dv.RowFilter =condition;
dv.Sort = "id Desc";
this.GridView1.DataSource = dv;
this.GridView1.DataBind();

}
}

为什么模糊查询可以
当我输入‘kk’精确查询就提示“用户代码未处理 EvaluateException”错误!
未找到列[kk]

这是为什么
哪位高手指点一下
谢谢!


奋起直追,犹未晚也!
2007-05-07 20:19
快速回复:搜索控件模块源代码
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.018005 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved