How to use Last_Insert_Id() in Insert Statement of Oracle in C# -


i have tried many solution mentioned none has returned value,
i'm using c# asp.net, , sql*plus(9.1.0) database(oracle);

i need insert record table seq , trigger increment id created, after inserting need inserted record's id reference. how write c# command last id output, have tried many, no luck, in database records insering nothing returning back,

string qry = "insert test1(id,name) values(1,'hello') returning id :lastid";      oracleparameter lastid = new oracleparameter(":lastid", oracletype.int32);            lastid.direction = parameterdirection.output;       using (oraclecommand cmd = new oraclecommand(qry, con))     {         con.open();         cmd.parameters.add(lastid);         cmd.executenonquery();         lblid.text= lastid.value.tostring();         con.close();     } 

have tried in database well, select last_insert_id(); didn't work returns nothing. please provide working c# code. if nothing works go on max(id) statement.


Comments