using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

public partial class manage_newsadd : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void btnok_Click(object sender, EventArgs e)
    {
        string scname = txt1.Text;
        string scontent = txt2.Text;
        string sql0;
        sql0 = "insert into news(ntitle,ncontent) values('" + scname + "','" + scontent + "')";
        if (FileUpload1.HasFile)
        {
            string npic ="/othpic/"+ FileUpload1.FileName;
            FileUpload1.PostedFile.SaveAs(Server.MapPath("../" + npic));
            sql0 = "insert into news(ntitle,ncontent,npic) values('" + scname + "','" + scontent + "','"+npic+"')";
        }       
        oper.opertb(sql0);
        Response.Write("<script>alert('新闻添加成功！');</script>");
    }
}
