我需要从数据库中选择值:
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());
我做错了什么?