1.数据操作类 SqlDBhelper

using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Configuration;
using System.Data;

namespace MessageTool
{
     public class SqlDbhelper
    {
        private SqlConnection conn;
        private SqlCommand cmd;
        private SqlDataReader reader;
        private SqlDataAdapter adapter;
        public  string connectionString = System.Configuration.ConfigurationSettings.AppSettings["connectionstring"];
 
        public string ConnectionString
        {
            get { return this.connectionString; }
            set { this.connectionString = value; }
        }
 
        ///
        /// 获取一个未打开连接的SqlConnection对象
        ///
        /// SqlConnection对象
        public SqlConnection GetConnection()
        {
            if (conn != null)
                return this.conn;
            return this.conn = new SqlConnection(connectionString);
        }
 
        ///
        /// 使用连接字符串获取未打开连接SqlConnection对象
        ///
        /// 连接字符串
        /// SqlConnection对象
        public SqlConnection GetConnection(string _connStr)
        {
            if (this.conn != null)
                this.conn.ConnectionString = _connStr;
   

展开阅读全文
©️2020 CSDN 皮肤主题: 点我我会动 设计师: 上身试试 返回首页
实付0元
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、C币套餐、付费专栏及课程。

余额充值