日期:2014-05-17 浏览次数:21072 次
CREATE TABLE "HY-WYH"."TEST_TABLE"
( "ID" NUMBER(*,0),
"NAME" VARCHAR2(4000 CHAR)
)
OracleConnection conn = new OracleConnection(GetConnectString());
OracleCommand cmd = conn.CreateCommand();
conn.Open();
cmd.CommandType=System.Data.CommandType.Text;
cmd.Parameters.Add(new OracleParameter("ID",OracleDbType.Int64)); // ID应该选什么类型
cmd.Parameters.Add(new OracleParameter("NAME", OracleDbType.Varchar2));
cmd.Parameters["ID"].Value=ID;
cmd.Parameters["NAME"].Value=Name;
cmd.CommandText="UPDATE TEST_TABLE SET \"NAME\"=:NAME WHERE \"ID\" = :ID";
//执行时引发如下异常
//Oracle.DataAccess.Client.OracleException ORA-01722: invalid number
int res = cmd.ExecuteNonQuery();