Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 2 of 2 total
Thread Problems accesing ElevateDB Data from VB6 Aplication
Mon, Dec 20 2010 12:09 PMPermanent Link

marcuslasky

Excuse me, my english writing is not good. Bear with me.

I recently purchased a business management application that uses as its product database, your product ElevateDB implemented as an SQL data server (client / server).
The ElevateDB version we use is 2.03b23.

I am developing an external application to analyze the information captured by this BMA which together with other external data allows me to draw up reports. To achieve this it is necessary the use of triggers to indicate my application when update, deletion and addition of records occurs. My problem is that I failed to implement it inside of the database and documentation seems confusing.

I recently obtained a reasonable level of interaction with the database ElevateDB in terms of speed and functionality by writing a data connector that invokes the ODBC Driver “dll file” internal routines.

But I still have some problems to solve.

1) Would it be possible to implement a trigger for the table * "invoice" performing a routine like this:
   USE ‘atrexdb’
    CREATE TRIGGER "BeforeUpdate" BEFORE UPDATE ON ‘invoice’
       BEGIN
           INSERT INTO dlinkdb (dtable, dfield, dvalue, doption)
           VALUES (‘invoice’, ‘number’, OLDROW.Number, ‘update’);
       END;

 Where dlinkdb is a operations log table inside the same database “atrexdb”.
  * Or any other table.

I failed to implement this function. Could it be a limitation of the database or simply  it is not possible to enter data into a table from the trigger of another table??.

2) Would it be possible to dump the data to a CVS text file or other generic data format, invoking this operation through an SQL sentence (or other method) that can be passed to the database via app code.

I've read that ElevateDB supports the integration of routines and functions in the form of DLL's that allow import and data migration to ElevateDB. The opposite (export data) would be possible too?

Thank you very much for your responses.

Ariel Almonte
IT Support.
CIMELE SRL.
Dominican Republic
Mon, Dec 20 2010 1:27 PMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Ariel


I assume that as well as buying the business management application you've also bought a copy of ElevateDB. If not you are not going to be able to achieve anything. If you have you'll also have a utility EDBManager. All you need then is the appropriate passwords and you can access the database and add triggers easily though its dialogs.

Adding the trigger is easy, getting the program code inside it can be a bit more difficult.

There are two ways of updating another table from within a trigger:

1. Use EXECUTE IMMEDIATE
2. Declare and use a sensitive cursor

For a simple operation such as your's EXECUTE IMMEDIATE is the easiest way. All you have to do is build a string that would be the SQL you would type and call it using EXECUTE IMMEDIATE eg

CREATE TRIGGER "BeforeUpdate" BEFORE UPDATE ON ‘invoice’
BEGIN
DECLARE SQLCode VARCHAR;
SET SQLCode ='INSERT INTO dlinkdb (dtable, dfield, dvalue, doption) VALUES ('''invoice'',''number'','+CAST( OLDROW.Number AS VARCHAR)+', ‘'update’')';
EXECUTE IMMEDIATE SQLCode;
END;


I think I've got the quotes right but I'm not certain Smiley

Roy Lambert [Team Elevate]
Image