using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using System.Collections;
using System.Configuration;
namespace SQLServerDAL
{
public abstract class SqlHelper
{
public static readonly string ConnectionStringLocalTransaction =ConfigurationManager.ConnectionStrings["SQLConnectionStirng"].ConnectionString;
public static SqlDataReader Exefdn(string scon, CommandType ctype, string SQL,SqlParameter param)
{
SqlCommand cm = new SqlCommand();
SqlConnection con = new SqlConnection(scon);
try
{
if (con.State != ConnectionState.Open)
{
con.Open();
}
cm.Connection = con;
cm.CommandText = SQL;
cm.CommandType = ctype;
if (param != null)
{
cm.Parameters.Add(param);
}
SqlDataReader dr = cm.ExecuteReader(CommandBehavior.CloseConnection);
cm.Parameters.Clear();
return dr;
}
catch (Exception)
{
con.Close();
throw;
}
}
}
}