日期:2014-05-16  浏览次数:21019 次

ASP.NET DataTable合并


public partial class ReportIndex1 : System.Web.UI.Page
    {
        protected string strNf = "2012";
        private DataTable dt = new DataTable();
       // private DataTable dt_SC_SUM;
        private DataTable dt_SC;
        private DataTable dt_SC_XF;
        private DataTable dt_SC_ZX;
       // private DataTable dt_JY_SUM;
        private DataTable dt_JY;
        private DataTable dt_JY_XF;
        private DataTable dt_JY_ZX;
        private DataTable dtDq = new DataTable();
        private int _S1 = 0;
        private int _S2 = 0;
        private int _S3 = 0;
        private int _J1 = 0;
        private int _J2 = 0;
        private int _J3 = 0;
        BLL.DIC_DQXX b_dqxx = new BLL.DIC_DQXX();
        private bool Exist=false;
        private int dqlenght = 0;
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
            }
            BindDate();
        }


        protected void btnCx_Click(object sender, EventArgs e)
        {
            
        }
        /// <summary>
        /// 绑定数据
        /// </summary>
        private void BindDate()
        {
            if (txtNf.Text == "")
            {
                txtNf.Text = strNf = DateTime.Now.Year.ToString();
            }
            else
            {
                strNf = txtNf.Text;
            }
            //获取地区名称
            string sql_dq = "select id from view_dqxx_scxkz_scxkz group by id";
            dtDq = DbHelperOra.QueryTable(sql_dq);
            for (int i = 1; i < 7; i++)
            {
                dtDq.Columns.Add(i.ToString(),typeof(string));
            }
            //获取林木持证企业数量
            string sql_Sc = "select id,count(*) from view_dqxx_scxkz_scxkz where SCXKZ_FBRQ<=add_months(to_date('" + strNf + "','yyyy'),12) and SCXKZ_ISTJ=0";
            sql_Sc += " group by id ";
            dt_SC = DbHelperOra.QueryTable(sql_Sc);
            //获取林木新发
            string sql_ScXf = "select id,count(*) from view_dqxx_scxkz_scxkz where SCXKZ_FBRQ >=to_date('" + strNf + "','yyyy')";
            sql_ScXf += " and  SCXK