protected void btnSave_Click(object sender, EventArgs e)
        {
            BBSDataContext lq = new BBSDataContext();
            BBSAnswer      ba = new BBSAnswer();

            ba.uID       = Convert.ToInt16(Session["uID"]);
            ba.bnID      = Convert.ToInt16(Request["id"]);
            ba.baContent = txtbaContent.Text;
            ba.baAddTime = System.DateTime.Now;
            lq.BBSAnswer.InsertOnSubmit(ba);
            lq.SubmitChanges();
            Response.Redirect("BBSAnswerList.aspx?id=" + Request["id"]);
        }
Beispiel #2
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            BBSDataContext lq   = new BBSDataContext();
            BBSNote        note = new BBSNote();

            note.bnSubject = txtbnSubject.Text;
            note.bnContent = txtbnContent.Text;
            note.bnID      = Convert.ToInt16(Session["uID"].ToString());
            note.bnAddTime = System.DateTime.Now;
            lq.BBSNote.InsertOnSubmit(note);
            lq.SubmitChanges();
            Response.Redirect("BBSNoteList.aspx");
        }
Beispiel #3
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            BBSDataContext lq   = new BBSDataContext(); //实例化LINQ类
            BBSNote        note = new BBSNote();        //创建一个新对象

            note.bnSubject = txtbnSubject.Text;
            note.bnContent = txtbnContent.Text;
            note.uID       = Convert.ToInt32(Session["uID"]);
            note.bnAddTime = System.DateTime.Now;
            lq.BBSNote.InsertOnSubmit(note);                           //执行插入数据操作
            lq.SubmitChanges();                                        //提交数据库
            Response.Redirect("BBSNoteList.aspx?id=" + Request["id"]); //重新定位到该页面
        }