App_Code/DB.cs

(开头部分) 27KB

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

using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
using System.Collections.Generic;
using System.Collections;

/// <summary>
/// 数据访问抽象基础类
/// Copyright (C) Maticsoft 
/// </summary>
public abstract class DB
{
    //数据库连接字符串(web.config来配置),多数据库可使用DBP来实现.
    public static string connectionString = "Data Source=localhost;Initial Catalog=CarDB;Integrated Security=True;";
    public DB()
    {
    }

    #region 公用方法
    /// <summary>
    /// 判断是否存在某表的某个字段
    /// </summary>
    /// <param name="tableName">表名称</param>
    /// <param name="columnName">列名称</param>
    /// <returns>是否存在</returns>
    public static bool ColumnExists(string tableName, string columnName)
    {
        string sql = "select count(1) from syscolumns where [id]=object_id('" + tableName + "') and [name]='" + columnName + "'";
        object res = GetSingle(sql);
        if (res == null)
        {
            return false;
        }
        return Convert.ToInt32(res) > 0;
    }
    public static int GetMaxID(string FieldName, string TableName)
    {
        string strsql = "select max(" + FieldName + ")+1 from " + TableName;
        object obj = GetSingle(strsql);
        if (obj == null)
        {
            return 1;
        }
        else
        {
            return int.Parse(obj.ToString());
        }
    }
    public static bool Exists(string strSql)
    {
        object obj = GetSingle(strSql);
        int cmdresult;
        if ((Object.Equals(obj, null)) || (Object.Equals(obj, System.DBNull.Value)))
后面还有 733 行代码,购买后查看完整代码

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

AI 解读 AI

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

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