[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: Using Win32OLE library for DAO

Masaki Suketa

8/2/2006 11:26:00 AM

Hello,
In message "Using Win32OLE library for DAO"
on 06/08/01, "Jatinder Singh" <jatinder.saundh@gmail.com> writes:

> I am trying to do something like following to connect to a MS Access db from
> ruby
> db = WIN32OLE.*new*("DAO.Database")
>
> but it gives me an error "accessQuery.rb:17:in `initialize': unknown OLE
> server: `DAO.Database' (WIN32OLER
> untimeError)"
> How can I use DAO object library from ruby?

I have not used DAO, but I hope that DAO.DBEngine is what you want.

require 'win32ole'
WIN32OLE_TYPE.progids.each do |p|
if /dao/i =~ p
puts p
end
end

In my win2k box, the result of above script is:
DAO.DBEngine.36
DAO.PrivateDBEngine.36
DAO.TableDef.36
DAO.Field.36
...

And
require 'win32ole'
dao = WIN32OLE.new('DAO.DBEngine.36')
works fine.

Regards,
Masaki Suketa