noth50
سه شنبه 03 بهمن 1391, 21:11 عصر
بادرود
من در classbase
namespace DataAccessLayer
{
public class ClassBase
{
public static void ENonQuery(string ConnectionString, string comtext, CommandType commandType, params SqlParameter[] parameter)
{
SqlConnection ConObj = new SqlConnection(ConnectionString);
SqlCommand ComObj = new SqlCommand();
ComObj.CommandText = comtext;
ComObj.Connection = ConObj;
ComObj.CommandType = commandType;
ComObj.Parameters.AddRange(parameter);
ConObj.Open();
ComObj.ExecuteNonQuery();
ConObj.Close();
}
public static string EScaler(string ConnectionString,string comtext, CommandType commandType, params SqlParameter[] parameter)
{
SqlConnection ConObj = new SqlConnection(ConnectionString);
SqlCommand ComObj = new SqlCommand();
ComObj.CommandText = comtext;
ComObj.Connection = ConObj;
ComObj.CommandType = commandType;
ComObj.Parameters.AddRange(parameter);
ConObj.Open();
string retval = ComObj.ExecuteScalar().ToString();
ConObj.Close();
return retval;
}
public static SqlDataReader EReader(string ConnectionString,string comtext, CommandType commandType, params SqlParameter[] parameter)
{
SqlConnection ConObj = new SqlConnection(ConnectionString);
SqlCommand ComObj = new SqlCommand();
ComObj.CommandText = comtext;
ComObj.Connection = ConObj;
ComObj.CommandType = commandType;
ComObj.Parameters.AddRange(parameter);
ConObj.Open();
SqlDataReader dr = ComObj.ExecuteReader(CommandBehavior.CloseConnecti on);
return dr;
}
}
نوشتم
حال میخواهم این کلاس ClassBase را در UI خودم که در localhost است فراخونی کنم
باتشکر
من در classbase
namespace DataAccessLayer
{
public class ClassBase
{
public static void ENonQuery(string ConnectionString, string comtext, CommandType commandType, params SqlParameter[] parameter)
{
SqlConnection ConObj = new SqlConnection(ConnectionString);
SqlCommand ComObj = new SqlCommand();
ComObj.CommandText = comtext;
ComObj.Connection = ConObj;
ComObj.CommandType = commandType;
ComObj.Parameters.AddRange(parameter);
ConObj.Open();
ComObj.ExecuteNonQuery();
ConObj.Close();
}
public static string EScaler(string ConnectionString,string comtext, CommandType commandType, params SqlParameter[] parameter)
{
SqlConnection ConObj = new SqlConnection(ConnectionString);
SqlCommand ComObj = new SqlCommand();
ComObj.CommandText = comtext;
ComObj.Connection = ConObj;
ComObj.CommandType = commandType;
ComObj.Parameters.AddRange(parameter);
ConObj.Open();
string retval = ComObj.ExecuteScalar().ToString();
ConObj.Close();
return retval;
}
public static SqlDataReader EReader(string ConnectionString,string comtext, CommandType commandType, params SqlParameter[] parameter)
{
SqlConnection ConObj = new SqlConnection(ConnectionString);
SqlCommand ComObj = new SqlCommand();
ComObj.CommandText = comtext;
ComObj.Connection = ConObj;
ComObj.CommandType = commandType;
ComObj.Parameters.AddRange(parameter);
ConObj.Open();
SqlDataReader dr = ComObj.ExecuteReader(CommandBehavior.CloseConnecti on);
return dr;
}
}
نوشتم
حال میخواهم این کلاس ClassBase را در UI خودم که در localhost است فراخونی کنم
باتشکر