Test_DAL/sys_Common.cs

(开头部分) 5KB

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

/******************************************************************
**-----------------------------------------------------------------
** Copyright (c) 2013 每天进步一点点
** Name: sys_Common
** Remarks: 
** Varsion: 1.0
** Author:  Jon
** Contact: 573741776@qq.com
** Last Edit User: 
** Last Edit Time: 2013-01-10
** Statement: 
**-----------------------------------------------------------------
******************************************************************/

using System;
using System.Collections.Generic;
using System.Data;
using Test_DBUtility;
using System.Text;
using System.Data.SqlClient;

namespace Test_DAL
{
    public class sys_Common
    {
        public readonly string connectionString = SqlHelper.LocalSqlServer;

        /// <summary>
        /// 是否存在该记录
        /// </summary>
        public bool Exists(int id, string tablename)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select count(1) from " + tablename + " ");
            strSql.Append(" where id=@id");
            SqlParameter[] parameters = {
					new SqlParameter("@id", SqlDbType.Int,4)
            };
            parameters[0].Value = id;

            return SqlHelper.ExistsRecord(connectionString, strSql.ToString(), parameters);
        }

        #region 删除数据
        /// <summary>
        /// 删除一条数据
        /// </summary>
        public bool Delete(string tableName, int id)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("delete from " + tableName + " ");
            strSql.Append(" where id=@id");
            SqlParameter[] parameters = {
					new SqlParameter("@id", SqlDbType.Int,4)
            };
            parameters[0].Value = id;

            int rows = SqlHelper.ExecuteSql(connectionString, strSql.ToString(), parameters);
            return rows > 0;
        }
后面还有 85 行代码,解锁后查看完整代码

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

AI 解读

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

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