代码如下:
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Data; using System.Data.SqlClient; using System.Configuration; namespace MyShopDAL { public class SqlHepler { //先添加引用,在.NET中,添加System.configuration private static readonly string connectionString = ConfigurationManager.ConnectionStrings["connStr"].ConnectionString; /// <summary> /// 数据处理 /// </summary> private static void PrepareCommand(SqlConnection conn, SqlCommand comm, string sql, SqlParameter[] parameter) { if (conn.State != ConnectionState.Open) { conn.Open(); comm.Connection = conn; comm.CommandType = CommandType.Text; //执行SQL文本命令 comm.CommandText = sql; if (parameter != null)
SqlHelper.cs类的数据接口
于 2022-05-17 19:07:06 首次发布