예제 #1
0
        /// <summary>
        /// 获取FieldName中最大的值
        /// </summary>
        /// <param name="FieldName">字段名</param>
        /// <param name="TableName">表明</param>
        /// <param name="accessPath">Access数据库路径</param>
        /// <returns></returns>
        public static int GetMaxID(string FieldName, string TableName, string accessPath)
        {
            string strsql = "select max(" + FieldName + ")+1 from " + TableName;
            object obj    = DbHelperAccess.GetSingle(strsql, accessPath);

            if (obj == null)
            {
                return(1);
            }
            else
            {
                return(int.Parse(obj.ToString()));
            }
        }
예제 #2
0
        public static int GetRecordCount(string _ID, string _tbName, string _strCondition, int _Dist, string accessPath)
        {
            string sql = getPageListCounts(_ID, _tbName, _strCondition, _Dist);

            object obj = DbHelperAccess.GetSingle(sql, accessPath);

            if (obj == null)
            {
                return(1);
            }
            else
            {
                return(int.Parse(obj.ToString()));
            }
        }
예제 #3
0
        /// <summary>
        /// 是否存在
        /// </summary>
        /// <param name="strSql">SQL语句</param>
        /// <param name="accessPath">Access数据库路径</param>
        /// <param name="cmdParms">参数</param>
        /// <returns></returns>
        public static bool Exists(string strSql, string accessPath, params OleDbParameter[] cmdParms)
        {
            object obj = DbHelperAccess.GetSingle(strSql, accessPath, cmdParms);
            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);
            }
        }