G
Guest
I am trying to get returned the autogenerated primary key value from Oracle
when I insert a row. I am using the Microsoft OracleConnection class. My code
is:
// cmd is an OracleCommand object.
cmd.CommandText += "; returning " + column_name + " into :r1";
OracleParameter pkParam = new OracleParameter();
pkParam.Direction = ParameterDirection.ReturnValue;
pkParam.DbType = DbType.Decimal;
cmd.Parameters.Add(pkParam);
object rtn = cmd.ExecuteScalar();
But ExecuteScalar() throws an exception. Any ideas?
--
thanks - dave
david_at_windward_dot_net
http://www.windwardreports.com
Cubicle Wars - http://www.windwardreports.com/film.htm
when I insert a row. I am using the Microsoft OracleConnection class. My code
is:
// cmd is an OracleCommand object.
cmd.CommandText += "; returning " + column_name + " into :r1";
OracleParameter pkParam = new OracleParameter();
pkParam.Direction = ParameterDirection.ReturnValue;
pkParam.DbType = DbType.Decimal;
cmd.Parameters.Add(pkParam);
object rtn = cmd.ExecuteScalar();
But ExecuteScalar() throws an exception. Any ideas?
--
thanks - dave
david_at_windward_dot_net
http://www.windwardreports.com
Cubicle Wars - http://www.windwardreports.com/film.htm