Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Connecting to Access Database
Message
From
06/05/2003 07:14:51
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00785246
Message ID:
00785256
Views:
45
>I am trying to access a Microsoft Access database throgh an ado connection. First I tried the connection string in a remote view to make sure the string was ok. I added the table using remote views and till now everything worked fine. Now i want to access the table through an ado recordset. So I copied the string over to the connection object. See Code Below :
>
>oConnection = CREATEOBJECT("adodb.Connection")
>oconnection.Open('DSN=MS Access Database;DBQ=C:\LeaveTranFile.mde;DriverId=25;FIL=MS Access;MaxBufferSize=2048;PageTimeout=5;SystemDB=C:\SecureLog.mdw;','leavelog','leavelogadmin',1)
>oRecordSet = CREATEOBJECT('adodb.recordset')
>orecordset.Open('Select * from leavelog',oConnection,1,1,1)
>
>********************************************************************
>
>As soon as i issue the last command the systemm gives me an error :
>
>OLE IDispatch exception code 0 from Microsoft OLE DB Provider for ODBC Drivers: ODBC driver does not support the requested properties...
>
>Does anyone have an idea of what i am doing wrong?
>
>Thanks.

Franco,
ADO uses OLEDB not ODBC. If you want to use ODBC (or for any connection that has ODBC driver but not OLEDB) you could use OLEDB for ODBC - MSDASQL provider.
However Access has an Oledb driver named Microsoft.Jet.Oledb.x.x where x stand for verion. ie :
local oRecordSet, oConnection
oRecordSet = Createobject("adodb.recordset")
oConnection = Createobject("adodb.connection")

lcMDBName = 'c:\myPath\Access Database Folder\myAcces.mdb'
With oConnection
  .ConnectionString = "Provider=Microsoft.Jet.Oledb.4.0;"+;
     "Data Source="+lcMDBName
  .Open()
Endwith
With oRecordSet
  .ActiveConnection = oConnection
  .CursorLocation= 3  && adUseClient
  .Source = "select * from [My Access TableName]"
  .Open
Endwith
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform