Exemplo n.º 1
0
        public void SetConnectionString(sqlServerTypeEnum sqlServerType)
        {
            switch (sqlServerType)
            {
            case sqlServerTypeEnum.sqlServer:
                _connectionString = ConfigurationManager.ConnectionStrings["sqlConnectionString"].ConnectionString;
                break;

            case sqlServerTypeEnum.sqlServerExpress:
                _connectionString = ConfigurationManager.ConnectionStrings["sqlExpressConnectionString"].ConnectionString;
                break;

            default:
                throw new ServerNotSupportedException();
            }
        }
        public void SetServer(sqlServerTypeEnum sqlServerType)
        {
            switch (sqlServerType)
            {
            case sqlServerTypeEnum.sqlServer:
                _server = new Server(@".");
                break;

            case sqlServerTypeEnum.sqlServerExpress:
                _server = new Server(@".\SQLEXPRESS");
                break;

            default:
                throw new ServerNotSupportedException();
            }
        }
Exemplo n.º 3
0
 private void InitializeCompenent(sqlServerTypeEnum sqlServerType)
 {
     SetConnectionString(sqlServerType);
     _sqlConnection = new SqlConnection(_connectionString);
     _sqlCommand    = _sqlConnection.CreateCommand();
 }