protected void Page_Load(object sender, EventArgs e)
{
HttpCookie phonebind = new HttpCookie("phonebind");
if (Request.Cookies["phonebind"] == null)
{
Response.Redirect("../index.aspx");
}
if (Request.QueryString["class"].ToString() == null)
{
Response.Redirect("../index.aspx");
}
string phclass = Request.QueryString["class"];
string phonexh=Request.Cookies["phonebind"].Value;
string sel = "select * from soft where [class]='"+ phclass +"' charindex(" + "'," + phonexh + ",',','+phone+',')>0"; SqlDataSource1.SelectCommand = sel;
SqlDataSource1.DataBind();
}帮我看下, 这个select哪错了第 1 行: 'charindex' 附近有语法错误。
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 异常详细信息: System.Data.SqlClient.SqlException: 第 1 行: 'charindex' 附近有语法错误。
{
HttpCookie phonebind = new HttpCookie("phonebind");
if (Request.Cookies["phonebind"] == null)
{
Response.Redirect("../index.aspx");
}
if (Request.QueryString["class"].ToString() == null)
{
Response.Redirect("../index.aspx");
}
string phclass = Request.QueryString["class"];
string phonexh=Request.Cookies["phonebind"].Value;
string sel = "select * from soft where [class]='"+ phclass +"' charindex(" + "'," + phonexh + ",',','+phone+',')>0"; SqlDataSource1.SelectCommand = sel;
SqlDataSource1.DataBind();
}帮我看下, 这个select哪错了第 1 行: 'charindex' 附近有语法错误。
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 异常详细信息: System.Data.SqlClient.SqlException: 第 1 行: 'charindex' 附近有语法错误。
解决方案 »
- 未将对象应用实例
- 用什么方法可以使图片上传之后,立刻更新啊
- 正则表达式
- asp.net项目除了IIS还可以部署在其他服务器上吗?
- 本机可以上传200K大小的图片 升级到服务器确出现问题
- 在服务器上应该怎样设置才可以开启xmlhttp组件的权限?
- 网页中嵌入iframe,打印这个网页时,iframe中的内容不能全部打印出来?在线等。。。
- 大家谁用过Infragistics UltraWebTree控件,能不能给我个数据邦定的例子
- swith case 中将结果存入数组 ,并用Repeater 绑定该数组(例子是一维数组,实际会用二维数组,只是测试)
- asp.net实现串口通信
- 求一简单的SQL统计语句
- 页面是否关闭问题
string sel = "select * from soft where [class]='"+ phclass +"' and charindex(" + "'," + phonexh + ",',','+phone+',')>0";