| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 443 人关注过本帖
标题:查询问题(急)
只看楼主 加入收藏
bavfhpdn66
Rank: 1
等 级:新手上路
威 望:1
帖 子:72
专家分:0
注 册:2007-4-11
收藏
 问题点数:0 回复次数:2 
查询问题(急)

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:22
川流不息
Rank: 6Rank: 6
等 级:贵宾
威 望:27
帖 子:2000
专家分:47
注 册:2006-11-8
收藏
得分:0 

if (this.ckbstart.Checked)
{
condition = "Start=" + this.txtstart.Text;

}

你這個字段是不是字符串?改為condition = "Start='" + this.txtstart.Text + "'";


日月更替,天地輪回,人間已是幾回春。 江山不老,人正少年,只手能擎半邊天。
2007-05-07 20:37
bavfhpdn66
Rank: 1
等 级:新手上路
威 望:1
帖 子:72
专家分:0
注 册:2007-4-11
收藏
得分:0 

谢谢你!
可以拉


奋起直追,犹未晚也!
2007-05-07 20:47
快速回复:查询问题(急)
数据加载中...
 
   



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

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