CreateSQLServerDatabase - Create a new SQL Server data or security database RegisterSQLServerDatabase - Register a SQL Server data database UnregisterSQLServerDatabase - Unregister a SQL Server data database |
These routines cover a range of database management tasks.
CreateSQLServerDatabase |
Create a new SQL Server data or security database.
Input
Parameter |
Description |
user |
Currently logged-in user as returned from Login |
databaseType |
Type of database; data or security (DataAccess.eMACRODbType) |
userName |
User name for SQL Server login |
password |
Password for SQL Server login |
databaseName |
Name of new database |
server |
Name of database server |
public static Enums.eDatabaseResult CreateSQLServerDatabase(UserProperties user, DataAccess.eMACRODbType databaseType, string userName, string password, string databaseName, string server) |
Output
· Return code indicating success or failure
RegisterSQLServerDatabase |
Register an existing SQL Server data MACRO database in the current MACRO security database.
Input
Parameter |
Description |
user |
Currently logged-in user as returned from Login |
userName |
User name for SQL Server login |
password |
Password for SQL Server login |
databaseName |
Name of database to be registered |
server |
Name of database server |
dbAlias |
DB Alias for database to be registered (max 15 characters) |
public static Enums.eDatabaseResult RegisterSQLServerDatabase(UserProperties user, string userName, string password, string databaseName, string server, string dbAlias) |
Output
· Return code indicating success or failure
UnregisterSQLServerDatabase |
Unregister a SQL Server data database.
Input
Parameter |
Description |
user |
Currently logged-in user as returned from Login |
dbAlias |
DB Alias for database to be unregistered |
public static Enums.eDatabaseResult UnregisterSQLServerDatabase(UserProperties user, string dbAlias) |
Output
· Return code indicating success or failure
The database management routines return an integer code as type Enums.eDatabaseResult indicating the overall result, as listed in the table below:
Code |
Value |
Description |
0 |
Success |
The operation was successful |
1 |
PermissionDenied | The current user does not have the relevant MACRO permissions to perform the action |
2 |
InvalidDatabaseType | The given database type was not recognised |
6 |
InvalidUserName | The given user name is not valid, e.g. it contains invalid characters, too many characters or is empty |
7 |
InvalidPassword | The given password was blank |
8 |
InvalidDatabaseName |
The given database name was blank or contains invalid characters |
9 |
InvalidServer | The given server was blank |
10 |
InvalidNetServiceName | The given Net Service name was blank or does not exist |
11 |
InvalidMACRODBAlias |
The given MACRO DB Alias was blank or does not exist |
12 |
InvalidConnectionDetails | A database connection could not be made using the given parameters |
13 |
DatabaseExists | The database already exists |
14 |
DatabaseNotFound | The database does not exist |
15 |
ErrorDuringCreation | An error occurred during database creation |
16 |
ErrorDuringRegistration | An error occurred during database registration |
17 |
CreateDatabaseSQLError | An error occurred during SQL Server database creation |
18 |
NotAMACRODatabase | The specified database is not recognised as a valid MACRO database |
19 |
DatabaseAlreadyRegistered | The database is already registered |
20 |
CannotUnregisterLoggedIntoDB |
It is not possible to unregister the currently logged in database |
21 |
NotASQLServerDatabase |
The specified database details do not refer to an SQL Server database |
99 |
Unknown |
An unknown error occurred |