public ActionResult Index() { using (OracleConnection conn = new OracleConnection()) { conn.ConnectionString = ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString; conn.Open(); OracleCommand cmd = new OracleCommand(); cmd.CommandText = "SELECT * from
public ActionResult Create() { using (OracleConnection conn = new OracleConnection()) { conn.ConnectionString = ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString; conn.Open(); OracleCommand cmd = new OracleCommand(); cmd.CommandText = "INSERT INTO
public ActionResult Edit( model) { using (OracleConnection conn = new OracleConnection()) { conn.ConnectionString = ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString; conn.Open(); OracleCommand cmd = new OracleCommand(); cmd.CommandText = "UPDATE
SET = WHERE "; cmd.Connection = conn; cmd.ExecuteNonQuery(); } return View(); }
删除数据
通过DELETE语句,可以实现数据库数据的删除。
public ActionResult Delete(string id) { using (OracleConnection conn = new OracleConnection()) { conn.ConnectionString = ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString; conn.Open(); OracleCommand cmd = new OracleCommand(); cmd.CommandText = "DELETE FROM