internal static string ExecuteScalar(string QueryString) { using (var con = new SqlConnection(ConStrProvider.GetEndUserConStr())) { con.Open(); var command = new SqlCommand(QueryString, con); return(command.ExecuteScalar().ToString()); } }
internal static void ExecuteNonQuery(string QueryString) { using (var con = new SqlConnection(ConStrProvider.GetEndUserConStr())) { con.Open(); var command = new SqlCommand(QueryString, con); command.ExecuteNonQuery(); } }
internal static DataTable ExecuteDataTable(string QueryString) { using (var con = new SqlConnection(ConStrProvider.GetEndUserConStr())) { con.Open(); DataTable DataTable = new DataTable(); SqlDataAdapter sd = new SqlDataAdapter(QueryString, con); sd.Fill(DataTable); return(DataTable); } }
public UnitOfWork(string csName) { switch (csName) { case "lab": //NOTE accessing to database on unit tests IS ILLEGAL break; case "end-user": this.Cntx = new SmcsContext(ConStrProvider.GetEndUserConStr()); break; default: throw new ApplicationException("Invalid ConStr on DbProvider .."); } }