本软件下载地址未录入,如想要软件请评论,我们会补上!DbHelper公用方法源码是一款可以在c#DbHelper中使用的源码,公共1方法。DBHelper.cs:Microsoft .NET技术 C#语言编写的源程序代码的文件后缀名。
//1.声明数据库连接
using (SqlConnection conn = new SqlConnection(connStr))
{
//2.声明命令
using (SqlCommand cmd = new SqlCommand(sql, conn))
{
//添加参数
if (pams != null && pams.Length > 0)
{
cmd.Parameters.AddRange(pams);
}
cmd.CommandType = cmdType;
//3.打开数据库连接
if (conn.State == ConnectionState.Closed)
{
conn.Open();
}
//4.执行命令
return cmd.ExecuteNonQuery();