此查询中的错误在哪里 [英] where is the error in this query

查看:66
本文介绍了此查询中的错误在哪里的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

select reg.nregisterid as RegNo,reg.semailid as Email,reg.ntradingoptionname as TradingOption,toperiod.ntradingoptionperiod as Period,reg.totalamount as Total,suserstatus as Status 
from tbregistermember as reg 
JOIN tbuserstatus as s on reg.nuserstatusid=s.nuserstatusid 
JOIN tbtradingoptionperiod as toperiod on reg.ntradingoptionperiodid=toperiod.ntradingoptionperiodid 
where dregistrationdate between " + frmdate.Text + "
and " + todate.Text + " 
and reg.nuserstatusid = " + Ddlstatus.SelectedValue + "

推荐答案

一个可能的错误来自您的输入.如果文本框中包含例如非法字符等,您将看到错误消息.

将文字值连接到SQL语句被认为是一种坏习惯.原因是您很容易受到SQL注入,数据类型不匹配等的影响.

代替直接将值添加到SQL语句中,请使用 SqlParameter [ ^ ]
One possible error is coming from your input. If the text boxes have for example illegal characters etc you will see an error message.

Concatenating literal values to an SQL statement is considered a bad habit. The reason is that you''re vulnerable to SQL injections, data type mismatches and so on.

Instead of adding the values directly to your SQL statement, use SqlParameter[^]


在"dregistrationdate"和"+"" + frmdate.Text +""+"和"+"" + todate.Text +''之前输入别名"+"
put alias name before "dregistrationdate" and " +"''"+ frmdate.Text +"''"+" and " +"''"+ todate.Text +"''"+ "


缺少注册日期别名的别名
Missing alias name of dregistrationdate coloumn


这篇关于此查询中的错误在哪里的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆