示例#1
0
        //---------------------------------------------------------------------------

        public bool Initialise(DbConnectionSettings settings)
        {
            // Critr.
            try
            {
                connectionCritr = new SqlConnection(settings.ConnectionString);
                connectionCritr.Open();
            }
            catch (Exception ex)
            {
                // Something's gone wrong, close any connections that were opened.
                try
                {
                    if (connectionCritr != null)
                    {
                        connectionCritr.Close();
                    }
                }
                catch {}

                throw new Exception(
                          "Critr database connection error." +
                          Environment.NewLine +
                          Environment.NewLine +
                          ex.Message);
            }

            return(true);
        }
示例#2
0
  //---------------------------------------------------------------------------

  public bool Initialise( DbConnectionSettings settings )
  {
    // Critr.
    try
    {
      connectionCritr = new SqlConnection( settings.ConnectionString );
      connectionCritr.Open();
    }
    catch( Exception ex )
    {
      // Something's gone wrong, close any connections that were opened.
      try
      {
        if( connectionCritr != null )
        {
          connectionCritr.Close();
        }
      }
      catch {}

      throw new Exception(
        "Critr database connection error." +
        Environment.NewLine +
        Environment.NewLine +
        ex.Message );
    }

    return true;
  }
示例#3
0
  //---------------------------------------------------------------------------

  private DbConnection()
  {
    DbConnectionSettings settings = new DbConnectionSettings();
    settings.ServerName = Program.Settings.GetSetting< string >( "Db.Critr.ServerName", @"odin\thoroughtec", true );
    settings.DbName = Program.Settings.GetSetting< string >( "Db.Critr.DbName", "Critr", true );
    settings.SqlUserName = Program.Settings.GetSetting< string >( "Db.Critr.UserName", "", true );
    settings.SqlPassword = Program.Settings.GetSetting< string >( "Db.Critr.Password", "", true );

    settings.UseSqlAuthentication = ( settings.SqlUserName.Length > 0 );

    Initialise( settings );
  }
示例#4
0
        //---------------------------------------------------------------------------

        private DbConnection()
        {
            DbConnectionSettings settings = new DbConnectionSettings();

            settings.ServerName  = Program.Settings.GetSetting <string>("Db.Critr.ServerName", @"odin\thoroughtec", true);
            settings.DbName      = Program.Settings.GetSetting <string>("Db.Critr.DbName", "Critr", true);
            settings.SqlUserName = Program.Settings.GetSetting <string>("Db.Critr.UserName", "", true);
            settings.SqlPassword = Program.Settings.GetSetting <string>("Db.Critr.Password", "", true);

            settings.UseSqlAuthentication = (settings.SqlUserName.Length > 0);

            Initialise(settings);
        }