using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;public partial class AddNovel : System.Web.UI.Page
{    Alert alert = new Alert();
    SqlHelper data = new SqlHelper();
    public string DownPath;
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            DropDownList1.DataSource = data.GetDataReader("select * from NovelType");
            DropDownList1.DataValueField = "id";
            DropDownList1.DataTextField = "name";
            DropDownList1.DataBind();        }    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        try
        {            string sql = "insert into Novel(FileName,ds,Typeid,TpeName,zuozhe,layuan,UserId,JianJie)values('" + txtName.Text + "','" + FCKeditor1.Value + "','" + DropDownList1.SelectedValue + "','" + DropDownList1.SelectedItem.Text + "','" + Session["UserName"].ToString() + "','" + TextBox3.Text + "','" + Session["UserId"].ToString() + "','"+TextBox1.Text+"')";            data.RunSql(sql);            Alert.AlertAndRedirect("添加成功!", "MyNovel.aspx");
        }
        catch
        {
            Alert.AlertAndRedirect("添加失败!", "MyNovel.aspx");
        }    }