![]() |
#3 |
Участник
|
Цитата:
Сообщение от Dark Light
![]() Точно можно сделать это через ODBCConnection и админскую учетку:
X++: ODBCConnection connection; LoginProperty loginProp; SysSQLSystemInfo systemInfo = SysSQLSystemInfo::construct(); Statement statement; Resultset resultSet; str otherStr; str sqlState; ; loginProp = new LoginProperty(); otherStr += "DRIVER={SQL Server}"; otherStr += ";Trusted_Connection=No"; otherStr += strfmt(";SERVER=%1", systemInfo.getLoginServer()); otherStr += strfmt(";DataBase=%1", systemInfo.getloginDatabase()); otherStr += strfmt(";UID=%1", 'Admin'); otherStr += strfmt(";PWD=%1", 'AdminPass'); loginProp.setOther(otherStr); connection = new ODBCConnection(loginProp); sqlState = strfmt('SELECT TOP 1 [RECID] FROM [%1].[dbo].[%2]', systemInfo.getloginDatabase(), tableStr(SysClientSessions)); statement = connection.createStatement(); new SqlStatementExecutePermission(sqlState).assert(); resultSet = statement.executeQuery(sqlState); CodeAccessPermission::revertAssert(); while (resultSet.next()) { info (int642str(resultSet.getInt64(1))); } |
|
|
|