private void btn_assign_Click(object sender, EventArgs e) { ProgramDAO pro = new ProgramDAO(); pa = new ProgramAuthors() { program_id = program_id, user_id = user_id }; int insert = pro.AssignUsers(pa); if (insert != 0) { MessageBox.Show("Author Added"); } }
/// <summary> /// Inserts data into user assign table /// </summary> /// <param name="t"></param> /// <returns></returns> public int AssignUsers(ProgramAuthors t) { Console.WriteLine(t.program_id + " " + t.user_id); int done = 0; try { conn.Open(); OracleCommand command = conn.CreateCommand(); command.CommandText = "insert into ASE.program_authors(id,program_id, user_id)" + "values(null,:program_id, :user_id)"; command.Parameters.Add(":program_id", t.program_id); command.Parameters.Add(":user_id", t.user_id); done = command.ExecuteNonQuery(); } catch (Exception ex) { } return(done); }