public static int GetMaxID(Base_Helper.PetaPoco.Database PCDb, string FieldName, string TableName)
        {
            string strsql = "select max(" + FieldName + ") from " + TableName;
            object obj    = PetaSQLHelper.GetSingle(PCDb, strsql);

            if (obj == null)
            {
                return(1);
            }
            else
            {
                return(int.Parse(obj.ToString()));
            }
        }
        public static bool Exists(Base_Helper.PetaPoco.Database PCDb, string strSql)
        {
            object obj = PetaSQLHelper.GetSingle(PCDb, strSql);
            int    cmdresult;

            if ((Object.Equals(obj, null)) || (Object.Equals(obj, System.DBNull.Value)))
            {
                cmdresult = 0;
            }
            else
            {
                cmdresult = int.Parse(obj.ToString());
            }
            if (cmdresult == 0)
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }
        /// <summary>
        /// 表是否存在
        /// </summary>
        /// <param name="TableName"></param>
        /// <returns></returns>
        public static bool TabExists(Base_Helper.PetaPoco.Database PCDb, string TableName)
        {
            string strsql = "select count(*) from sysobjects where id = object_id(N'[" + TableName + "]') and OBJECTPROPERTY(id, N'IsUserTable') = 1";
            //string strsql = "SELECT count(*) FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[" + TableName + "]') AND type in (N'U')";
            object obj = PetaSQLHelper.GetSingle(PCDb, strsql);
            int    cmdresult;

            if ((Object.Equals(obj, null)) || (Object.Equals(obj, System.DBNull.Value)))
            {
                cmdresult = 0;
            }
            else
            {
                cmdresult = int.Parse(obj.ToString());
            }
            if (cmdresult == 0)
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }