SqlHelper.cs
(开头部分) 4KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.SqlClient;
using System.Data;
using System.Configuration;
public class SqlHelper
{
public static readonly string conString = ConfigurationManager.ConnectionStrings["sqlCon"].ConnectionString;
//增删改
public static bool ExeNonQuery(string sql, CommandType type, params SqlParameter[] lists)
{
bool bFlag = false;
using (SqlConnection con = new SqlConnection(conString))
{
SqlCommand cmd = new SqlCommand();
cmd.Connection = con;
cmd.CommandText = sql;
cmd.CommandType = type;
if (lists!=null)
{
foreach (SqlParameter p in lists)
{
cmd.Parameters.Add(p);
}
}
try
{
if (con.State == ConnectionState.Closed)
{
con.Open();
}
int result = cmd.ExecuteNonQuery();
if (result > 0)
{
bFlag = true;
}
}
catch { ;}
}
return bFlag;
}
//查.读
public static SqlDataReader ExeDataReader(string sql, CommandType type, params SqlParameter[] lists)
{
SqlConnection con = new SqlConnection(conString);
SqlCommand cmd = new SqlCommand();
cmd.Connection = con;
cmd.CommandText = sql;
cmd.CommandType = type;
if (con.State == ConnectionState.Closed)
{
con.Open();
}
后面还有 87 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
