DBUtility/DbHelperOleDb.cs

(开头部分) 23KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Collections;
using System.Collections.Specialized;
using System.Data.SqlClient;using System.Data;
using System.Data.OleDb;
using System.Configuration;
using System.Web;

namespace DBUtility
{
    /// <summary>
    /// Copyright (C) 2010 it134.cn
    /// 数据访问基础类(基于OleDb)
    /// 可以用户可以修改满足自己项目的需要。
    /// </summary>
    public abstract class DbHelperOleDb
    {
        //数据库连接字符串(web.config来配置),可以动态更改connectionString支持多数据库.		
        public static string connectionString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString.ToString();

        public DbHelperOleDb()
        {
        }

        #region  执行简单SQL语句

        /// <summary>
        /// 取得最大记录
        /// </summary>
        /// <param name="FieldName"></param>
        /// <param name="TableName"></param>
        /// <returns></returns>
        public static int GetMaxID(string FieldName, string TableName)
        {
            string strsql = "select top 1 " + FieldName + " from " + TableName + " order by " + FieldName + " desc";
            object obj = GetSingle(strsql);
            if (obj == null)
            {
                return 0;
            }
            else
            {
                return int.Parse(obj.ToString());
            }
        }

        /// <summary>
        /// 查询该记录是否存在 简单
        /// </summary>
        /// <param name="strSql"></param>
        /// <returns></returns>
        public static bool Exists(string strSql)
        {
            object obj = GetSingle(strSql);
            int cmdresult;
            if ((Object.Equals(obj, null)) || (Object.Equals(obj, System.DBNull.Value)))
            {
                cmdresult = 0;
            }
            else
后面还有 599 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。