Manipulating an SQL Database in E3.

Although Elipse E3 already lets you back up tables, these backup files are created in the same file where the data being used by the application is. In some cases, you will need to back up an entire database, but this feature hasn’t been implemented in E3 yet.

This article then presents a simple alternative for backing up and restoring the database which does not require any knowledge of SQL commands. By the end of this article, you will find a module (library) developed by Elipse that can be used in your application.

Requirements

To do so, you will need to have basic VBScript knowledge. In addition, you will also need these tools:

  • SQL Server 2008 (Express, Standard, Enterprise) Installed.
  • Microsoft SQL Server 2005 Backward Compatibility Components (32 bits or 64 bits).

NOTE: When using SQL Server 2005, the ActiveX SQL-DMO is also installed by default. You will only need to download it if your SQL Server 2005 installation has been customized.

The other tools seen in this article are part of Elipse E3 and need no further download.

Installing SQL Distributed Management Objects (SQL-DMO)

If the SQL Server is already installed in your machine (local or remote), then you will need to install the ActiveX component that handles the database management objects.

After downloading it, follow these guidelines:

1. Click Next to start installation.

2. Accept its license agreement.

3. Set up both your name and you company’s name.

4. Select the components to be installed. The only item you will need is SQL-DMO. Other tools can also be installed alongside it, but their uses will not be discussed in this article.

5. Click Install to install the selected components.

6. When the installation is complete, the following window will be displayed. Click Finish.

Application

A demo application was created to illustrate how to use ManipulacaoDB library to manipulate the databases in an SQL Server. Basically, the application allows users to create backups (programmed or not) and restore databases from a previously created backup.

ManipulacaoDB Library

The ManipulacaoDB library comprised an XObject (DadosManipulaBD) and an XControl (ManipulaBD). In addition to these two objects, you must create a database in the application. This database will be used by the library to connect to the SQL Server.

ManipulaBD: User interface object. It contains scripts that execute tasks contained in the DadosManipulaDB data onject. This object also lists all databases existing in an SQL Server. To use this object, you must insert it onto a screen and set up DadosManipulaDB path (which must be inserted into a database) at Source property.

DadosManupulaBD: Contains the scripts for backing up and restoring data.

Attachments:

RestoreBackupDB.zip

Print Friendly, PDF & Email

Este artigo foi útil? Was this helpful?

Classificação média - Average rating 0 / 5. Count: 0

Leave a Reply

Your email address will not be published.Required fields are marked *