使用ExecuteOracleScalar()的InvalidOperationException

时间:2013-07-22 06:42:09

标签: oracle select invalidoperationexception

我需要从数据库中选择值:

    string AttrIdent = "";           

    OracleCommand sel_attr = new OracleCommand(@"

    select 
        IDENTIFIER_ 
    from 
        TBL_A_CUSTOM_FORM_BASE_ATTR
    where 
        TEMPLATEUUID in(
                        select UUID 
                        from TBL_A_CUSTOM_FORM_TEMPLATE
                        where PARENTUUID =:projid) 
        and IDENTIFIER_ in ('xxx',
                            'yyy',
                            'zzz')", conn);

    sel_attr.Parameters.Add("projid", OracleType.NVarChar).Value = id;
    sel_attr.CommandType = CommandType.Text;
    AttrIdent = Convert.ToString(sel_attr.ExecuteOracleScalar());

但是我在

中得到了InvalidOperationException
 AttrIdent = Convert.ToString(sel_attr.ExecuteOracleScalar());

我做错了什么?

0 个答案:

没有答案