Board index » delphi » Direct connection to Microsoft ACCESS data base ?

Direct connection to Microsoft ACCESS data base ?

I'm using Delphi 16 with MS ACCESS base (by ODBC), it most slowly than
Visual BASIC 4. I'm looking for a delphi componant to access to Microsoft
ACCESS without ODBC interface.

Thanks

--
mailTo: alcino.co...@hol.fr

 

Re:Direct connection to Microsoft ACCESS data base ?


On 9 Apr 1997 16:10:32 GMT, "Alcino COSTA" <alcino.co...@hol.fr>
wrote:

Quote
>I'm using Delphi 16 with MS ACCESS base (by ODBC), it most slowly than
>Visual BASIC 4. I'm looking for a delphi componant to access to Microsoft
>ACCESS without ODBC interface.

No 16 bit OLE interface, so I've read from MS.  I'd bet that the
following, although written for D2, could be put in a DLL and thunked
via D1. I don't have the time, but I'll bet it could be done fairly
painlessly...If the D2 version will help at all, here it is.

Add OleAuto to the Uses clause, put a button and a listbox on a form
and change the table, data and database to something relevant...I use
this on the local ISP to keep track of people from the different towns
in eastern Colorado. Of course, it's late bound, but for small to
medium databases it's acceptably fast. OBTW, you need the  DAO dlls
before any of this will work. :-)

procedure TForm1.BitBtn1Click(Sender: TObject);
Var
  DataBase, DBEngine, RecordSet : Variant;
  Query, TempStr : String;
Begin
  Query := 'SELECT * FROM DIR3322 WHERE [City] = "lajunta"';
  Try
    Screen.Cursor := crHourGlass;
    Try
         // Instantiate the DAO engine
      DBEngine := CreateOleObject('DAO.DBEngine');
         // Open the database
      DataBase := DBEngine.OpenDataBase('D:\Data\DIR3322.Mdb');
         // Open the recordset, querydef or tabledef
      RecordSet := DataBase.OpenRecordset(Query);
         // Loop through the recordset
      While Not RecordSet.EOF Do Begin
          // Get the user field (variant to string)
        TempStr := RecordSet.Fields['User'];
          // Add it to the listbox
        ListBox1.Items.Add(TempStr);
          // Move to next field (can also use previous, first, last)
        RecordSet.Movenext;
          // Just because
        Application.ProcessMessages;
      End;
    Except
      On eOleError Do
        MessageDlg('There was an error!', mtError, [mbOk], 0);
    End;
  Finally
    Screen.Cursor := crDefault;
  End;
End;

Hope this helps. Chances are that if you upgrade to D3 this stuff
will be a moot point.

JE McTaggart
t...@ria.net

Re:Direct connection to Microsoft ACCESS data base ?


Quote
t...@iguana.ruralnet.net (JE McTaggart) wrote:
>On 9 Apr 1997 16:10:32 GMT, "Alcino COSTA" <alcino.co...@hol.fr>
>wrote:
>>I'm using Delphi 16 with MS ACCESS base (by ODBC), it most slowly than
>>Visual BASIC 4. I'm looking for a delphi componant to access to Microsoft
>>ACCESS without ODBC interface.

You might try ODBCExpress (16 bit is freeware, 32 bit about $200 US,
do a web search).   You cannot use the BDE or the Borland data aware
components, but ODBCExpress provides analogous components (although
you will miss the
DBLookup components).   It has its quirks, and documentation is thin,
but it bypasses BDE and makes ODBC calls direcly to the driver.
Because of this, you won't have to distribute the BDE, which is quite
a bonus.  

You have to write more code and the thin documentation is a drawback,
but it's all SQL driven.  I am not sold yet, but it seems promising.
----------
Bob Peticolas

Other Threads