// 撈出此本書的最新的章節
        public int 目前最新章節(AddBookChaptersModel ac)
        {
            SqlConnection con = new SqlConnection(myDBConnectionString);

            con.Open();

            string     tSQL = "select max(bc_Chapters) as bc_Chapters from BooksChapters where b_id = @bId";
            SqlCommand cmd  = new SqlCommand(tSQL, con);

            cmd.Parameters.AddWithValue("bId", ac.b_id);
            SqlDataReader reader = cmd.ExecuteReader();

            int 目前最新章節數 = 0;

            if (ac.b_id != null)
            {
                if (reader.Read())
                {
                    目前最新章節數 = (int)reader["bc_Chapters"];
                }
            }

            reader.Close();
            con.Close();

            return(目前最新章節數);
        }
        // 將資料儲存到 BookOutline 與 BooksChapters 資料表
        public void 儲存章節標題及檔名(AddBookChaptersModel ac)
        {
            SqlConnection con = new SqlConnection(myDBConnectionString);

            con.Open();

            // 新增到書籍大綱資料表
            string     tSQL = "Insert into BooksChapters (b_id,bc_Chapters,bc_Content)Values(@bId,@bcChapters,@bcContent)";
            SqlCommand cmd  = new SqlCommand(tSQL, con);

            cmd.Parameters.AddWithValue("bId", ac.b_id);
            cmd.Parameters.AddWithValue("bcChapters", ac.bc_Chapters);
            cmd.Parameters.AddWithValue("bcContent", ac.bc_Content);

            cmd.ExecuteNonQuery();


            // 撈回 BooksChapters 資料表,目前自動編號的最大值 (要塞到 BooksFiles 資料表使用的)
            string        tSQL1  = "select max(bc_id) as bc_id from BooksChapters";
            SqlCommand    cmd1   = new SqlCommand(tSQL1, con);
            SqlDataReader reader = cmd1.ExecuteReader();

            int maxbc_id = 0;

            if (reader.Read())
            {
                maxbc_id = (int)reader["bc_id"];
            }

            reader.Close();


            // 新增到書籍章節資料表
            string     tSQL2 = "";
            SqlCommand cmd2  = new SqlCommand();

            cmd2.Connection = con;

            foreach (string Files in ac.FilesName)
            {
                tSQL2            = "Insert into BooksFiles (bc_id,bf_FileName)Values('" + maxbc_id + "','" + Files + "')";
                cmd2.CommandText = tSQL2;

                cmd2.ExecuteNonQuery();
            }

            // 新增到書籍資料表
            // 連載情況
            string     tSQL3 = "update books set b_Series_yn=@bSeries where b_id=@bid";
            SqlCommand cmd3  = new SqlCommand(tSQL3, con);

            cmd3.Parameters.AddWithValue("bid", ac.b_id);

            char 連載情況;

            if (ac.b_Series_yn == "連載中")
            {
                連載情況 = 'y';
                cmd3.Parameters.AddWithValue("bSeries", 連載情況);
            }
            else if (ac.b_Series_yn == "已完結")
            {
                連載情況 = 'n';
                cmd3.Parameters.AddWithValue("bSeries", 連載情況);
            }

            cmd3.ExecuteNonQuery();

            con.Close();
        }