C# Oralce 10G

在项目中,用参数处理Update语句。 参数名称与表字段同名。 执行错误: ORA-01722:无效数字

稍后修改所有参数和对应的字段。 解决。

对象返回值=null;

Sr SQL.append (更新CRM _ contacts _ resources et );

strsql.append (‘ resource _ name=: resource _ name,’);

strsql.append (‘ resource _ desc=: resource _ desc,’);

strsql.append (object _ id=: object _ id,);

strsql.append (‘ primary _ keys=: primary _ keys,’);

Sr SQL.append (‘ modified _ by=: modified _ by,’);

strsql.append (modified _ date=: modified _ date );

Sr SQL.append (where contacts _ id=: contacts _ idan dserial _ no=: serial _ noandtype _ code=3360 type _ no

OracleParameter[] parameters={

neworacleparameter ‘ : resource _ name ‘,oracledb type.varchar 2,50 ),

neworacleparameter (‘ : resource _ desc ‘,oracledb type.varchar 2,200 )、

neworacleparameter (‘ : object _ id ‘,oracledb type.varchar 2,10 ),

neworacleparameter (‘ : primary _ keys ‘,oracledb type.varchar 2,50 )、

neworacleparameter (‘ : modified _ by ‘,oracledb type.varchar 2,10 ),

neworacleparameter ‘ : modified _ date ‘,OracleDbType.Date ),

neworacleparameter ‘ : contacts _ id ‘,OracleDbType.Decimal,10 ),

neworacleparameter (‘ : serial _ no ‘,OracleDbType.Decimal,4 ),

neworacleparameter (‘ : type _ code ‘,oracledb type.varchar 2,1 );

parameters [0].value=contactsrparm.resource _ name;

parameters [1].value=contactsrparm.resource _ desc;

parameters [2].value=contactsrparm.object _ id;

parameters [3].value=contactsrparm.primary _ keys;

parameters [4].value=contactsrparm.modified _ by;

parameters [5].value=contactsrparm.modified _ date;

parameters [6].value=contactsrparm.contacts _ id;

parameters [7].value=contactsrparm.serial _ no;

if(contactsrparm.type_code==’0′ )//人脉

{

parameters[8].Value=’A ‘;

}

else if (contactsrparm.type _ code==’1′ )//外部资源

{

parameters[8].Value=’B ‘;

}

对象返回值=null;

Sr SQL.append (更新CRM _ contacts _ resources et );

Sr SQL.append (resource _ name=: resourcename,);

Sr SQL.append (resource _ desc=:资源desc,);

Sr SQL.append (object _ id=: objectid,);

Sr SQL.append (primary _ keys=: primary keys,);

strsql.append (modified _ by=: modified by,);

Sr SQL.append (修改日期=:修改日期);

Sr SQL.append (where contacts _ id=: contactsidandserial _ no=: serialnoandtype _ code=3: typecode );

OracleParameter[] parameters={

neworacleparameter ‘ : resourcename ‘,oracledb type.varchar 2,50 ),

neworacleparameter ‘ : resource desc ‘,oracledb type.varchar 2,200 ),

neworacleparameter ‘ : objectid ‘,oracledb type.varchar 2,10 ),

neworacleparameter ‘ :主密钥’,oracledb type.varchar 2,50 ),

neworacleparameter (‘ :修改by ‘,oracledb type.varchar 2,10 ),

neworacleparameter ‘ :修改日期’,OracleDbType.Date ),

neworacleparameter ‘ : contacts id ‘,OracleDbType.Decimal,10 ),

neworacleparameter (‘ : serial no ‘,OracleDbType.Decimal,4 ),

neworacleparameter (‘ : typecode ‘,oracledb type.varchar 2,1 );

parameters [0].value=contactsrparm.resource _ name;

parameters [1].value=contactsrparm.resource _ desc;

parameters [2].value=contactsrparm.object _ id;

parameters [3].value=contactsrparm.primary _ keys;

parameters [4].value=contactsrparm.modified _ by;

parameters [5].value=contactsrparm.modified _ date;

parameters [6].value=contactsrparm.contacts _ id;

parameters [7].value=contactsrparm.serial _ no;

if(contactsrparm.type_code==’0′ )//人脉

{

parameters[8].Value=’A ‘;

}

else if (contactsrparm.type _ code==’1′ )//外部资源

{

parameters[8].Value=’B ‘;

}