给你个例子[.NET中三层构架开发实例 - 用户注册系统]

作者:袖梨 2022-07-02
数据库基类
using System;
using System.Data;
using System.Data.SqlClient;
namespace HaiSky.HtJob
{
    ///
    /// DbClass 的摘要说明。
    ///

    public class DbClass
    {
        private string connectionString;
        protected SqlConnection Connection;
        public DbClass(string newConnectionString)
        {
            connectionString = newConnectionString;
            Connection = new SqlConnection(connectionString);
        }
        public string ConnectionString
        {
            get
            {
                return connectionString;
            }
        }
        private SqlCommand BuildQueryCommand(string storedProcName,IDataParameter[] parameters)
        {
            SqlCommand command = new SqlCommand(storedProcName,Connection);
            command.CommandType = CommandType.StoredProcedure;

相关文章

精彩推荐