Exemple #1
0
        public static int ODBCGetMaxID(string FieldName, string TableName)
        {
            string ODBCSQL = "select max(" + FieldName + ")+1 from " + TableName;
            object obj     = ODBCHelperSQL.ODBCGetSingle(ODBCSQL);

            if (obj == null)
            {
                return(1);
            }
            else
            {
                return(int.Parse(obj.ToString()));
            }
        }
Exemple #2
0
        public static bool ODBCExists(string ODBCSQL)
        {
            object obj = ODBCHelperSQL.ODBCGetSingle(ODBCSQL);
            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);
            }
        }
Exemple #3
0
        /// <summary>
        /// 表是否存在
        /// </summary>
        /// <param name="TableName"></param>
        /// <returns></returns>
        public static bool ODBCTabExists(string TableName)
        {
            string ODBCSQL = "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 = ODBCHelperSQL.ODBCGetSingle(ODBCSQL);
            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);
            }
        }