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); } }
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); } }
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); } }