/**
     *
     * CREATE TRIGGER no_price ON book_table
     *  FOR INSERT
     *          AS
     *      IF(
     *              (
     *                  SELECT COUNT(*) FROM inserted
     *                  WHERE inserted.price<0
     *
     *                  )>0
     *
     *          )
     *
     *                                  raiserror('价格不能小于0',16,11)
     *      rollback TRANSACTION;
     **/

    protected void insert_book_Click(object sender, EventArgs e)//添加书籍信息
    {
        book_tableTableAdapter adprbook = new book_tableTableAdapter();

        int    id        = Int32.Parse(TextBox_bookid.Text);
        string name      = TextBox_bookname.Text;
        string writer    = TextBox_writer.Text;
        string publisher = TextBox_publisher.Text;
        int    left      = Int32.Parse(TextBox_left.Text);
        float  price     = float.Parse(TextBox_price.Text);
        int    floor     = Int32.Parse(TextBox_floor.Text);
        int    shelve    = Int32.Parse(TextBox_shelve.Text);

        try
        {
            locationTableAdapter locationadpr = new locationTableAdapter();
            adprbook.InsertQuery(id, name, writer, publisher, left, price);

            locationadpr.InsertQuery(id, floor, shelve);
            bookGridView.DataBind();
        }
        catch (Exception exp)
        {
            bookinsertMsg.Text = exp.Message;
            //bookinsertMsg.Text = "输入数据错误";
            bookinsertMsg.Visible = true;
            //return;
        }
    }