Is that correct way of reading data from table then insert into table ?
I am trying to read the max number or rec_id to create seq column the +1 to insert my data record into same table
//Opening the connection with Oracle Database
OracleConnection conn = new OracleConnection(oradb);
conn.Open();
//Create the oracle statment and insert data into oracle database
OracleCommand cmd1 = new OracleCommand();
cmd1.Connection = conn;
cmd1.CommandText = "SELECT NVL (MAX (rec_id), 0) + 1 FROM backup_check";
OracleDataReader dr = cmd1.ExecuteReader();
dr.Read();
label1.Text = dr.GetString(0);
conn.Dispose();
OracleCommand cmd = new OracleCommand();
cmd.Connection = conn;
//OracleTransaction trans = conn.BeginTransaction(); -- add rollback in case of transaction not complate for some reason
cmd.CommandText = "insert into my table(" + "'" + v_rec_id + "'" + ",OFFICE_CODE,DUMP_NAME,DUMP_STATUS,SYSTEM,CHECK_DATE)values(null,null," + "'" + keyword + "'" + ",'0','abc',sysdate)";
cmd.ExecuteNonQuery();
//Closing the connection with oracle databae
conn.Dispose();