コード例 #1
0
        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());
            }
        }
コード例 #2
0
        internal static void ExecuteNonQuery(string QueryString)
        {
            using (var con = new SqlConnection(ConStrProvider.GetEndUserConStr()))
            {
                con.Open();

                var command = new SqlCommand(QueryString, con);
                command.ExecuteNonQuery();
            }
        }
コード例 #3
0
        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);
            }
        }
コード例 #4
0
        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 ..");
            }
        }