问一个Oracle和C#的数据库访问中,Sql参数的问题
是这样的,很久没用Oracle了
最近一个项目中需要用到Oracle,结果出现了很奇怪的问题,出示事例代码:
OracleConnection con = ConnectionInfo.GetConnection();
OracleCommand cmd = con.CreateCommand();
cmd.CommandText = "UPDATE T_GROUP SET NAME = :NAME, VALUE = :VALUE WHERE ID = :ID ";
cmd.Parameters.Add( ":ID ", OracleDbType.Varchar2).Value = "AE279B5E3C504F5BA91D139AAE3B1864 ";
cmd.Parameters.Add( ":NAME ", OracleDbType.NVarchar2).Value = "美女与野兽12 ";
cmd.Parameters.Add( ":VALUE ", OracleDbType.Int16).Value = 2;
try
{
con.Open();
int r = cmd.ExecuteNonQuery();
Console.WriteLine(r);
}
catch (OracleException err)
{
throw err;
}
finally
{
if (con.State == System.Data.ConnectionState.Open)
{
con.Close();
}
}
--数据库
create table T_GROUP
(
id VARCHAR2(32) default SYS_GUID() not null,
name NVARCHAR2(20) not null,
value NU