public ActionResult Edit_College(COLLEGE item) { if (ModelState.IsValid) { OracleConnection con = new OracleConnection("DATA SOURCE = 192.168.56.101:1521 / orcl; PERSIST SECURITY INFO = True; USER ID = ABDUL; PASSWORD= abdul"); OracleCommand cmd = new OracleCommand(); cmd.CommandText = "Update college set name='" + item.NAME.ToString() + "',address='" + item.ADDRESS.ToString() + "' where college_id=" + item.COLLEGE_ID.ToString(); cmd.Connection = con; con.Open(); cmd.ExecuteNonQuery(); con.Close(); } return(RedirectToAction("Display_Colleges")); }
public ActionResult Create(COLLEGE college) { if (ModelState.IsValid) { OracleConnection con = new OracleConnection("DATA SOURCE = 192.168.56.101:1521 / orcl; PERSIST SECURITY INFO = True; USER ID = ABDUL; PASSWORD= abdul"); OracleCommand cmd = new OracleCommand(); cmd.CommandText = "Insert into College(college_id,name,address) values (genid.nextval,' " + college.NAME + " ',' " + college.ADDRESS + " ')"; cmd.Connection = con; con.Open(); cmd.ExecuteNonQuery(); con.Close(); return(RedirectToAction("Display_Colleges")); } return(View(college)); }
public ActionResult Edit_College(int id) { COLLEGE item = new COLLEGE(); OracleConnection con = new OracleConnection("DATA SOURCE = 192.168.56.101:1521 / orcl; PERSIST SECURITY INFO = True; USER ID = ABDUL; PASSWORD= abdul"); OracleCommand cmd = new OracleCommand(); cmd.CommandText = "select * from college where college_id=" + id.ToString(); cmd.Connection = con; con.Open(); OracleDataReader dr = cmd.ExecuteReader(); dr.Read(); item.NAME = dr["name"].ToString(); item.ADDRESS = dr["address"].ToString(); item.COLLEGE_ID = id; con.Close(); return(View(item)); }