Selectedvalue因为不存在而无效 [英] Selectedvalue which is invalid because it does not exist
问题描述
错误消息
txt_pay'有一个SelectedValue无效,因为它不存在于
项目列表中。参数名称:值
选择
@ZAPPRS_NO = APPRS_NO,
@ZBANKCODE = BANKCD,
@ZPAY = PAY_TYPE,
@ZACT_STAT = PAYRUN,
@ZBANKNAME = BANKNAME,
@ZINT_CODE = INT_NO
来自贷款的
其中IDNO = @ZIDNO和APPRS_NO = @ ZAPPRS_NO AND LOANUMBER = @ ZLOANUMBER
上面给出了错误信息
选择
@ZAPPRS_NO = APPRS_NO,
@ZBANKCODE = BANKCD,
@ZPAY = PAY_TYPE,
@ZACT_STAT = PAYRUN,
@ZBANKNAME = BANKNAME,>
@ZINT_CODE = INT_NO
来自贷款的
其中IDNO = @ZIDNO和APPRS_NO = @ ZAPPRS_NO
但是当我拿走时第三个条件,程序工作LOANUMBER = @ ZLOANUMBER:
< b> txt_Pay 是一个下拉列表
我尝试过:
在互联网上检查但是在select语句中没有示例
error message
txt_pay' has a SelectedValue which is invalid because it does not exist in the
list of items. Parameter name: value
Select
@ZAPPRS_NO = APPRS_NO ,
@ZBANKCODE = BANKCD ,
@ZPAY = PAY_TYPE ,
@ZACT_STAT = PAYRUN ,
@ZBANKNAME = BANKNAME ,
@ZINT_CODE = INT_NO
from LOANS Where IDNO= @ZIDNO AND APPRS_NO=@ZAPPRS_NO AND LOANUMBER=@ZLOANUMBER
The above gives the error message
Select
@ZAPPRS_NO = APPRS_NO ,
@ZBANKCODE = BANKCD ,
@ZPAY = PAY_TYPE ,
@ZACT_STAT = PAYRUN ,
@ZBANKNAME = BANKNAME ,
@ZINT_CODE = INT_NO
from LOANS Where IDNO= @ZIDNO AND APPRS_NO=@ZAPPRS_NO
However when I take of the 3rd condition the progam works "LOANUMBER=@ZLOANUMBER:
txt_Pay is a drop down list
What I have tried:
Checked on the internet but there is no example on select statement
推荐答案
从我收集的内容来看,问题不在于SQL语句本身而是在您调用或绑定语句的代码中。
您似乎有一个名为txt_pay
的对象,而您尝试使用SelectedValue
属性从中获取值。这会失败,因为没有选择或者值没有绑定到select语句。
仔细检查ASP.NET代码中的所有参数绑定。例如,看看 SqlDataSource.SelectParameters属性(System.Web.UI.WebControls) [ ^ ]
From what I gather, the problem is not in the SQL statement itself but in the code where you call or bind the statement.
You seem to have an object namedtxt_pay
and you try to get a value from it usingSelectedValue
property. This fails because there is no selection or the value isn't bound to your select statement.
Double check all the parameter bindings int the ASP.NET code. For an example, have a look at SqlDataSource.SelectParameters Property (System.Web.UI.WebControls)[^]
这篇关于Selectedvalue因为不存在而无效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!