Copies an existing database, either on the client or the server, to a new database, including all associated databases and objects. If the database is copied on the server, the new database is started.
Syntax
EsbCopyDatabase (hCtx, hSrcCtx, AppName, nAppName, DbName, nDbName) ByVal hCtx As Long ByVal hSrcCtx As Long ByVal AppName As String ByVal nAppName As String ByVal DbName As String ByVal nDbName As String
Parameter | Description |
---|---|
hCtx | VB API context handle. |
hSrcCtx | Not used - should be same as hCtx. |
AppName | Name of a source application. |
nAppName | Name of a destination application. |
DbName | Name of an existing database to copy. |
nDbName | Name of a new database. See Database Name Limits. |
Notes
Copying a client database copies the local database directory and contents.
This function can only be used to copy a client database to a new database on the client, or a server database to a new database on the same server. Use EsbCopyObject() to copy a database between different servers.
Return Value
None.
Access
For a server database, the caller must have database Create/Delete/Edit privilege (ESB_PRIV_DBCREATE).
Example
Declare Function EsbCopyDatabase Lib "ESBAPIN" (ByVal hCtx As Long, ByVal hSrcCtx As Long, ByVal SrcApp As String, ByVal DestApp As String, ByVal SrcDb As String, ByVal DestDb As String) As Long Sub ESB_CopyDatabase () Dim sts As Long Dim SrcApp As String Dim DestApp As String Dim SrcDb As String Dim DestDb As String Dim hSrcCtx As Long hSrcCtx = hCtx SrcApp = "Sample" DestApp = "NewSamp" SrcDb = "Basic" DestDb = "NewBasic" '*************** ' Copy database '*************** sts = EsbCopyDatabase (hCtx, hSrcCtx, SrcApp, DestApp, SrcDb, DestDb) End Sub
See Also