Показать сообщение отдельно
Старый 29.07.2013, 09:29   #13  
Ace of Database is offline
Ace of Database
Участник
Аватар для Ace of Database
 
870 / 637 (23) +++++++
Регистрация: 14.10.2004
Цитата:
Сообщение от ansoft Посмотреть сообщение
Как переключиться в текущем соединении...
...на другую БД? Подскажите...
переменная odbcConnection - член класса

X++:
#ODBCConnectionEntries
//инициализация класса
public boolean init(
                    str   _server,       //имя сервера
                    str     _database,     //база данных
                    str     _login,
                    str     _password
                    )
{
    LoginProperty     LP;
    str               otherStr;
    ;

        LP = new LoginProperty();

        otherStr = "DRIVER={SQL Server}";
        otherStr += ";Trusted_Connection=No";
        otherStr += strfmt(";SERVER=%1",    _server);
        otherStr += strfmt(";DataBase=%1",  _database);
        otherStr += strfmt(";UID=%1",       _login);
        otherStr += strfmt(";PWD=%1",       _password);
        LP.setOther(otherStr);

        odbcConnection = new OdbcConnection(LP);

        if (! odbcConnection)
        {
            return checkFailed("Ошибка при создании соединения");
        }

    return true;
}

Последний раз редактировалось Ace of Database; 29.07.2013 в 09:34.