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;

/// <summary>
/// SqlHelper 的摘要说明
/// </summary>
public class SqlHelper
{
    //应用连接字符串,创建连接对象
    private static readonly string ConnectionString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
    SqlConnection conn = new SqlConnection(ConnectionString);
    //
    public SqlCommand GetCommand(string sqlStr, params SqlParameter[] cmdparms)
    {
        SqlCommand cmd = new SqlCommand();
        cmd.Connection = conn;
        cmd.CommandText = sqlStr;
        cmd.CommandType = CommandType.Text;
        if (cmdparms != null)
        {
            foreach (SqlParameter p in cmdparms)
            {
                cmd.Parameters.Add(p);
            }
        }
        return cmd;
    }
	public SqlHelper()
	{
		//
		// TODO: 在此处添加构造函数逻辑
		//
        conn.Open();
	}
}
