日期:2014-05-18 浏览次数:20416 次
protected void modify_Click(object sender, EventArgs e) { int id = Convert.ToInt32(Request.QueryString["id"]); string title = this.newsTitle.Text; string content = this.newsContent.Value; string sql = string.Format(@"updata news set n_title = '{0}',n_title = '{1}' where n_id = {2}", title,content,id); int num = db.NotQuery(sql); if (num > 0) { Response.Redirect("NewsManage.aspx"); } }
//执行不是查询的语句 public int NotQuery(string s) { int num = 0; try { myConnection.Open(); //string sql = string.Format(s); OleDbCommand myCommand = new OleDbCommand(s, myConnection); num = myCommand.ExecuteNonQuery(); return num; } catch (Exception e) { e.ToString(); } finally { myConnection.Close(); } return num; }