增删改查小案例

修改简介
protected void BtnSubmit_Click(object sender, EventArgs e)
    {
            MyConn = DB.CreateDB();
            MyConn.Open();
            string content =FunStr(this.TxtContent.Text);
            OleDbCommand cmd1 = new OleDbCommand("Update about set About='" + content + "'", MyConn);
            cmd1.ExecuteNonQuery();
            Response.Write("");
            MyConn.Close();
    }


添加新闻

 

if (this.IsValid)
        {
            string title = Request["TxtTitle"].ToString();
            string addurl = Request["TxtAddurl"].ToString();
            OleDbConnection myconn = DB.CreateDB();
            myconn.Open();
            OleDbCommand cmd = new OleDbCommand("insert into link(title,addurl) values('" + title + "','" + addurl + "')", myconn);
            cmd.ExecuteNonQuery();
            Response.Write("");
            myconn.Close();
        }


你可能感兴趣的:(ASP.NET实例)