帮我注释一下吧
帮我把下面这段代码注释一吧 谢谢大家了
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
//该源码首发自www.51aspx.com(51aspx.com)
/// <summary>
/// SqlHelper 的摘要说明
/// </summary>
public class SqlHelper
{
private static readonly string strConn = ConfigurationManager.ConnectionStrings["TangCompanyConn"].ConnectionString;
private static readonly string strName = ConfigurationManager.AppSettings["userName"].ToString();
private static readonly string strPass = ConfigurationManager.AppSettings["userPass"].ToString();
public SqlHelper()
{
//
// TODO: 在此处添加构造函数逻辑
//
}
public static SqlDataReader ExcuteRead(string nText, CommandType nType, SqlParameter[] paras) {
SqlConnection conn = new SqlConnection(strConn);
SqlCommand cmd = new SqlCommand();
try
{
PrepareCommand(conn, cmd, null, nType, nText, paras);
SqlDataReader dr = cmd.ExecuteReader(CommandBehavior.CloseConnection);
cmd.Parameters.Clear();
return dr;
}
catch(SqlException ex){
throw new Exception(ex.Message, ex);
}
}
public static int ExcuteNonQurey(string nText, CommandType nType, SqlParameter[] paras) {
SqlCommand cmd = new SqlCommand();
using (SqlConnection conn = new SqlConnection(strConn)) {
PrepareCommand(conn, cmd, null, nType, nText, paras);
int rows = cmd.ExecuteNonQuery();
cmd.Parameters.Clear();
return rows;
}
}
public static object ExcuteSclare(string nText, CommandType nType, SqlParameter[] paras) {
SqlCommand cmd = new SqlCommand();
using (SqlConnection conn = new SqlConnection(strConn)) {
PrepareCommand(conn, cmd, null, nType, nText, paras);
object obj = cmd.ExecuteScalar();
cmd.Parameters.Clear();
return obj;
}
}
public static DataSet ExcuteReadApdater(string nText, CommandType nType, SqlParameter[] paras) {
SqlConnection con = new SqlConnection(strConn);
SqlCommand cmd = new SqlCommand();
DataSet ds = new DataSet();
try
{
PrepareCommand(con, cmd, null, nType, nText, paras);
SqlDataAdapter sqlAdapter = new SqlDataAdapter(cmd);
sqlAdapter.Fill(ds);
cmd.Parameters.Clear();
return ds;
}
catch (SqlException ex) {
throw new Exception(ex.Message, ex);
}
}
public static void PrepareCommand(SqlConnection con, SqlCommand cmd, SqlTransaction trans, CommandType nType, string nText, SqlParameter[] paras) {
if (con.State != ConnectionState.Open)
con.Open();
cmd.Connection = con;