public DataTable Get统计( string strWhere )
        {
            int nYNow = DateTime.Now.Year;
            int nY80 = nYNow - 80;
            int nY90 = nYNow - 90;
            int nY100 = nYNow - 100;

            string str80 = String.Format("{0}-01-01", nY80);
            string str90 = String.Format( "{0}-01-01", nY90 );
            string str100 = String.Format( "{0}-01-01", nY100 );

            DataTable dt = new DataTable();

            SQL Sql = new SQL( DBParam.Sql.Connect );

            if ( strWhere.Trim() != "" )
                strWhere = " Where " + strWhere;

            string strSql = String.Format( @"select 街道, 
                                            SUM( CASE WHEN 出生日期 >= '{0}' and 出生日期 < '{1}' THEN 1 ELSE 0 END) as 年龄段80,
                                            SUM( CASE WHEN 出生日期 >= '{1}' and 出生日期 < '{2}' THEN 1 ELSE 0 END) as 年龄段90,
                                            SUM( CASE WHEN 出生日期 >= '{2}' THEN 1 ELSE 0 END) as 年龄段100
                                                                          
                                            from {3} {4}  group by 街道 ",
                                            str80, str90, str100,
                                            DB.Tab.老龄办.发放老龄津贴.TAB, strWhere );
            dt = Sql.ExecDataTable( strSql );

            Sql.Close();

            return dt;
        }
        //Get one Page data from all 
        public DataTable GetPage(int nPageNo, string strWhere)
        {
            SQL Sql = new SQL(FF.TD.Def.ConnectStr);

            DataTable dt = new DataTable();
            string strSql = SQL.GetPageSql(Tab.TEST_LOG.TAB, nPageNo, FrontFlag.Test.DEF.PageSize, Tab.TEST_LOG.ID, strWhere);
            dt = Sql.ExecDataTable(strSql);

            Sql.Close();
            return dt;
        }
        //Get one Page data from all 
        public DataTable GetPage( int nPageNo, string strWhere )
        {
            SQL Sql = new SQL( DBParam.Sql.Connect );

            DataTable dt = new DataTable();
            string strSql = SQL.GetPageSql2005( DB.Tab.优抚科.优抚对象.铀矿开采军队退役人员员子女役人员.基本信息.TAB, nPageNo, CONST.PageSize, DB.Tab.优抚科.优抚对象.铀矿开采军队退役人员员子女役人员.基本信息.ID, strWhere, false );
            dt = Sql.ExecDataTable( strSql );

            Sql.Close();
            return dt;
        }
        //Get one Page data from all 
        public DataTable GetPage( int nPageNo, string strWhere )
        {
            SQL Sql = new SQL( DBParam.Sql.Connect );

            DataTable dt = new DataTable();
            string strSql = SQL.GetPageSql2005( DB.Tab.事务科.低收入居民.TAB, nPageNo, CONST.PageSize, DB.Tab.事务科.低收入居民.ID, strWhere, false );
            dt = Sql.ExecDataTable( strSql );

            Sql.Close();
            return dt;
        }
        public DataTable GetCount( string strWhere )
        {
            DataTable dt = new DataTable();

            SQL Sql = new SQL ( DBParam.Sql.Connect );

            if (strWhere.Trim() != "")
                strWhere = " Where " + strWhere;

            string strSql = String.Format("select Count(*) from {0} {1} ", DB.Tab.基层科.社区服务信息管理_社区公益服务.TAB, strWhere);
            dt = Sql.ExecDataTable(strSql);

            Sql.Close();

            return dt;
        }
        public DataTable GetWhere( string strWhere )
        {
            DataTable dt = new DataTable();

            SQL Sql = new SQL( DBParam.Sql.Connect );

            if ( strWhere.Trim() != "" )
                strWhere = " Where " + strWhere;

            string strSql = String.Format( "select * from {0} {1} order by ID desc", DB.Tab.事务科.低收入居民.TAB, strWhere );
            dt = Sql.ExecDataTable( strSql );

            Sql.Close();

            return dt;
        }
        public DataTable GetWhere(string strWhere)
        {
            DataTable dt = new DataTable();

            SQL Sql = new SQL(FF.TD.Def.ConnectStr);

            if (strWhere.Trim() != "")
                strWhere = " Where " + strWhere;

            string strSql = String.Format("select * from {0} {1} order by ID desc", Tab.TEST_LOG.TAB, strWhere);
            dt = Sql.ExecDataTable(strSql);

            Sql.Close();

            return dt;

        }
        /// <summary>
        /// 查找指定Type的ID.
        /// </summary>
        /// <param name="strName"></param>
        /// <param name="strParenID"></param>
        /// <returns></returns>
        string GetPahtID( string strName, string strParenID )
        {
            SQL Sql = new SQL( CONNECT.SqlConnect );

            string strRet = "";

            string strSql = String.Format( "select {0} from {1} where {2}='{3}' and {4}='{5}' ", Tab.ID, Tab.TAB, Tab.Name, strName, Tab.ParentID, strParenID );

            DataTable dt = Sql.ExecDataTable( strSql );

            if( SQL.IsValid( ref dt ) )
            {
                strRet = dt.Rows[0][Tab.ID].ToString().Trim();
            }

            Sql.Close();

            return strRet;
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="strID"></param>
        /// <returns></returns>
        DIC_STRU GetStru_ByID( string strID )
        {
            SQL Sql = new SQL( CONNECT.SqlConnect );

            string strRet = "";

            string strSql = String.Format( "select * from {1} where {2}='{3}' ", Tab.ID, Tab.TAB, Tab.ID, strID );

            DataTable dt = Sql.ExecDataTable( strSql );
            Sql.Close();

            if( !SQL.IsValid( ref dt ) )
                return null;

            DIC_STRU stru = new DIC_STRU();

            DataRow dr = dt.Rows[0];
            stru.Dr2Stru( dr );

            return stru;
        }
        public DataTable Get统计( string strWhere )
        {
            DataTable dt = new DataTable();

            SQL Sql = new SQL( DBParam.Sql.Connect );

            if ( strWhere.Trim() != "" )
                strWhere = " Where " + strWhere;

            string strSql = String.Format( @"select 街道, 
                                            SUM( CASE WHEN 优待证类别 = '黄证' THEN 1 ELSE 0 END) as 黄证,
                                            SUM( CASE WHEN 优待证类别 = '蓝证' THEN 1 ELSE 0 END) as 蓝证,
                                            SUM( CASE WHEN 优待证类别 = '免费乘车证' THEN 1 ELSE 0 END) as 免费乘车证,   
                                            Count(*) as 合计                                            
                                            from {0} {1}  group by 街道 ",
                                            DB.Tab.老龄办.敬老优待证.TAB, strWhere );
            dt = Sql.ExecDataTable( strSql );

            Sql.Close();

            return dt;
        }
        public DataTable GetWhere( string strWhere )
        {
            DataTable dt = new DataTable();

            FrontFlag.SQL sql = new SQL( CONNECT.SqlConnect );

            if( strWhere.Trim() != "" )
                strWhere = " Where " + strWhere;

            string strSql = String.Format( "select * from {0} {1} order by ID desc", Tab.TAB, strWhere );
            dt = sql.ExecDataTable( strSql );

            sql.Close();

            return dt;

        }
        /// <summary>
        /// 获取父路径下的所有子参数。
        /// </summary>
        /// <param name="strParenID"></param>
        /// <returns></returns>
        public List<DIC_STRU> GetAllChild( string strParenID )
        {
            SQL Sql = new SQL( CONNECT.SqlConnect );

            List<DIC_STRU> list = new List<DIC_STRU>();

            string strSql = String.Format( "select * from {0} where {1}='{2}' order by {3} ", Tab.TAB, Tab.ParentID, strParenID, Tab.OrderNo );

            DataTable dt = Sql.ExecDataTable( strSql );
            list = DIC_STRU.Dt2List( ref dt );

            Sql.Close();

            return list;
        }
        public DataTable GetSum( string strFld, string strWhere )
        {
            DataTable dt = new DataTable();

            SQL Sql = new SQL( DBParam.Sql.Connect );

            if ( strWhere.Trim() != "" )
                strWhere = " Where " + strWhere;

            string strSql = String.Format( "select Sum({2}) from {0} {1} ", DB.Tab.老龄办.敬老优待证统计.TAB, strWhere, strFld );
            dt = Sql.ExecDataTable( strSql );

            Sql.Close();

            return dt;
        }
        /// <summary>
        /// 查找所有子项中最大的序号。
        /// </summary>
        /// <param name="strParenID"></param>
        /// <returns></returns>
        public int GetChildMaxNo( string strParenID )
        {
            SQL Sql = new SQL( CONNECT.SqlConnect );

            List<DIC_STRU> list = new List<DIC_STRU>();

            string strSql = String.Format( "select * from {0} where {1}='{2}' order by {3} desc ", Tab.TAB, Tab.ParentID, strParenID, Tab.OrderNo );

            DataTable dt = Sql.ExecDataTable( strSql );
            list = DIC_STRU.Dt2List( ref dt );

            Sql.Close();

            if( list == null || list.Count <= 0 )
                return 0;

            int nNo = FF.Fun.MyConvert.Str2Int( list[0].OrderNo );
            return nNo;
        }
        public DataTable GetCount( string strWhere )
        {
            DataTable dt = new DataTable();

            SQL Sql = new SQL( DBParam.Sql.Connect );

            if ( strWhere.Trim() != "" )
                strWhere = " Where " + strWhere;

            string strSql = String.Format( "select Count(*) from {0} {1} ", DB.Tab.优抚科.优抚对象.铀矿开采军队退役人员.生活费来源.TAB, strWhere );
            dt = Sql.ExecDataTable( strSql );

            Sql.Close();

            return dt;
        }
        public DIC_STRU GetNextChild( DIC_STRU stru )
        {
            if( !stru.IsValid() )
                return null;

            string strParenID = stru.ParentID;
            if( strParenID == String.Empty )
                return null;

            string strCurNo = stru.OrderNo;

            SQL Sql = new SQL( CONNECT.SqlConnect );

            List<DIC_STRU> list = new List<DIC_STRU>();

            string strSql = String.Format( "select top 1 * from {0} where {1}='{2}' and {3}>{4} order by {3} ", Tab.TAB, Tab.ParentID, strParenID, Tab.OrderNo, strCurNo );

            DataTable dt = Sql.ExecDataTable( strSql );
            list = DIC_STRU.Dt2List( ref dt );

            Sql.Close();

            if( list == null || list.Count <= 0 )
                return null;

            return list[0];
        }
        public DIC_STRU Get_ByID( string strID )
        {
            if( strID.Trim() == String.Empty )
                return null;

            SQL Sql = new SQL( CONNECT.SqlConnect );

            List<DIC_STRU> list = new List<DIC_STRU>();

            string strSql = String.Format( "select * from {0} where {1}='{2}' ", Tab.TAB, Tab.ID, strID );

            DataTable dt = Sql.ExecDataTable( strSql );
            list = DIC_STRU.Dt2List( ref dt );

            Sql.Close();

            if( list == null || list.Count <= 0 )
                return null;

            return list[0];
        }