Exemplo n.º 1
0
        public static int GetMaxID(String StrFieldName, String StrTableName)
        {
            JDBBASE db = DbConnectionPool.Instance();

            try
            {
                if (db != null)
                {
                    String strSQL   = "SELECT MAX(" + StrFieldName + ") FROM " + StrTableName;
                    Object objValue = db.GetStrValue(strSQL);
                    if (objValue.Equals(""))
                    {
                        objValue = "0";
                    }
                    return(int.Parse(objValue.ToString()) + 1);
                }
                else
                {
                    log4net.WriteLogFile("获取连接对象失败", 3);
                    return(0);
                }
            }
            finally
            {
                DbConnectionPool.ReturnConnect(db);
            }
        }
Exemplo n.º 2
0
        public static bool Exists(string strSQL)
        {
            JDBBASE db = DbConnectionPool.Instance();

            try
            {
                if (db != null)
                {
                    string obj     = db.GetStrValue(strSQL);
                    int    iResult = obj.Equals("") ? 0 : int.Parse(obj);
                    if (iResult > 0)
                    {
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
                else
                {
                    log4net.WriteLogFile("获取连接对象失败", 3);
                    return(false);
                }
            }
            finally
            {
                DbConnectionPool.ReturnConnect(db);
            }
        }
Exemplo n.º 3
0
        public static String GetStrValue(string strSQL)
        {
            JDBBASE db = DbConnectionPool.Instance();

            try
            {
                if (db != null)
                {
                    return(db.GetStrValue(strSQL));
                }
                else
                {
                    log4net.WriteLogFile("G_CN:GetStrValue:获取连接对象失败", 3);
                    return("");
                }
            }
            finally
            {
                DbConnectionPool.ReturnConnect(db);
            }
        }