Microsoft access

Posted by Giancarlo Alberto Somma on 22-May-2018 01:51

Hi to all

What's the best way to connect OE 11.7 with Microsoft access dB?

Many thanks.

G.

All Replies

Posted by dbeavon on 22-May-2018 07:36

Are you talking about doing it in the ABLlanguage?

In general the OE ABL language has little in the way of accessing data outside of its own OE database.  Some of the types of resources it can connect to are:  OE database, local file system, JMS message brokers, soap/rest services.  It does have something called "DataServer" to connect to SQL Server and Oracle but that option will cost quite a bit, and it has a lot of moving parts that you might not expect (ie. "schema holders").  

If you are on then Windows platform, then I'd suggest you do all the Microsoft access stuff outside of ABL (eg. in a local command line program or WCF service).  You could redirect the input/output via the file system in a pinch.

Posted by Brian K. Maher on 22-May-2018 07:42

and ActiveX Automation (original poster should consider using ADO if they want to interact with Access from the ABL)
 
 
Brian Maher
Principal Engineer, Technical Support
Progress
Progress
14 Oak Park | Bedford, MA 01730 | USA
phone
+1 781 280 3075
 
 
Twitter
Facebook
LinkedIn
Google+
 
 
ProgressNext2018_Email_Signature
 

Posted by Scott.Winkeler on 22-May-2018 07:53

You can read and write using the System.Data.OleDB.*. class.  Here is a small example of a procedure to write to an access db table.  

/* ***************************  Definitions  ************************** */

DEFINE VARIABLE Conn       AS CLASS     System.Data.OleDb.OleDbConnection  NO-UNDO.

DEFINE VARIABLE Cmd        AS CLASS     System.Data.OleDb.OleDbCommand     NO-UNDO.

DEFINE VARIABLE Adapter    AS CLASS     System.Data.OleDb.OleDbDataAdapter NO-UNDO.

DEFINE VARIABLE Reader     AS CLASS     System.Data.OleDb.OleDbDataReader  NO-UNDO.

DEFINE VARIABLE Writer     AS CLASS     System.Data.OleDb.OleDbTransaction NO-UNDO.

DEFINE VARIABLE chrPicPath AS CHARACTER NO-UNDO.

DEFINE VARIABLE chrQuery   AS CHARACTER NO-UNDO.

/* ********************  Preprocessor Definitions  ******************** */

/* ***************************  Main Block  *************************** */

FOR EACH emp-mstr NO-LOCK

where emp-mstr.psoftid <> ?.

   ASSIGN

       chrPicPath = "I:\Personnel\Employee Pictures\" + string(emp-Mstr.psoftid,'999999') + ".jpg"

       chrQuery = "Insert into Employee ([EmpID],[PSoftID],[FName],[PrefFName],[LName],[DeptID],[NasEmp],[PicPath],[CSC-Member],[FAT-Member],[FC-Member],[FRT-Member],[TMatics],[Active]) values (" + string(emp-mstr.empid) + "," + string(emp-mstr.psoftid) + ",'" + emp-mstr.fname + "','" + emp-mstr.Preffname + "','" + emp-mstr.lname + "'," + string(emp-mstr.deptid) + "," + string(emp-mstr.nasemp) + ",'" + chrPicPath + "'," + string(emp-mstr.csc-member) + "," + string(emp-mstr.fat-member) + "," + string(emp-mstr.fc-member) + "," + string(emp-mstr.frt-member) + "," + string(emp-mstr.tmatics) + "," + string(emp-mstr.active) + ");".

   Conn = NEW System.Data.OleDb.OleDbConnection("Provider=Microsoft.Jet.OleDb.4.0;Data Source=H:\Zebra_Cardstudio\nascote.mdb;").

   Conn:Open().

   Writer = Conn:BeginTransaction(System.Data.IsolationLevel:Unspecified).

   Cmd = NEW System.Data.OleDb.OleDBCommand(chrQuery,conn,Writer).

   Cmd:CommandText = chrQuery.

   Cmd:ExecuteNonQuery().

   Writer:Commit().

   Conn:Close().

END.

Posted by Giancarlo Alberto Somma on 06-Jun-2018 06:50

Hi,

thanks for your help.

What's I can find System.Data.OleDB.*. class. ?

Thx a lot

Posted by Steve Moore on 08-Jun-2018 12:44

You need to add System.Data to assemblies.xml using the Progress Assembly References program.

You should see it in the Global Assemblies tab.

Posted by Giancarlo Alberto Somma on 08-Jun-2018 15:23

Thanks.

Posted by Giancarlo Alberto Somma on 12-Jun-2018 00:53

Hello,

is it possible to create dinamically table and field (from DB OE) on ACCESS DB using Sistem.Data?

Thx

Posted by Giancarlo Alberto Somma on 13-Jun-2018 01:05

Hi Scott,

do you suggest manual/document in order to use OE with ADO,NET. I need more example.

many thanks.

G.

Posted by Roger Blanchard on 14-Jun-2018 06:18

Sure, but you have to write the code. We do that today with a SQLite DB.

By using the BUFFER object handle you have access to all the buffer fields.

DO I = 1 TO buffer-object:NUM-FIELDS:

   hBufferField = buffer=object:BUFFER-FIELD(I).

   /*

   By using the BUFFER-FIELD handle you have access to DATA-TYPE, NAME, FORMAT, DEFAULT-VALUE, etc.

   */  

END.

You would have to create class to use the System.Data.OleDb.OleDbCommand to create the table/fields.

Posted by Giancarlo Alberto Somma on 19-Jun-2018 00:26

Hi Roger,

thanks for help.

I have a TEMP-TABLE to export in MDB. Is it possible too?

Thx.

G.

Posted by Roger Blanchard on 19-Jun-2018 07:07

TT buffer is no different than DB table buffer.

Posted by Giancarlo Alberto Somma on 22-Jun-2018 02:40

Hi,

I have problem to load data with this separator " ' ". Some fields description contains this character.

Is it possibie to change?

Thx.

This thread is closed