Using Win32OLE library for DAO

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?

Thanks in advance,
Jatinder

I could use Database class of DAO by writing following code,

accessApp = WIN32OLE.*new*('Access.Application')

*accessDB* = accessApp.CurrentDb()

accessDB is an instance of DAO.Database class.

But is there a way I could use DAO directly?

Regards,

Jatinder

···

On 8/1/06, Jatinder Singh <jatinder.saundh@gmail.com> wrote:

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?

Thanks in advance,
Jatinder

Hello,

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

···

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

Jatinder Singh wrote:

I could use Database class of DAO by writing following code,

accessApp = WIN32OLE.*new*('Access.Application')

*accessDB* = accessApp.CurrentDb()

accessDB is an instance of DAO.Database class.

But is there a way I could use DAO directly?

Regards,

Jatinder

Just out of curosity... *why* do you want to use DAO?

···

--
Posted via http://www.ruby-forum.com/\.

I am trying to get an instance of DAO.DataTypeEnum class using Win32OLE but
it gives the error mentioned before in my earlier email.
Apart from the classes which are listed when ur script is run, there are
other classes under DAO which I want to instantiate and use.

Thanks and Regards,
Jatinder

···

On 8/2/06, Masaki Suketa <masaki.suketa@nifty.ne.jp> wrote:

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

To read Microsoft Access tables data like TableDefs, Tables etc from Ruby.

Regards,
Jatinder

···

On 8/1/06, Patrick Spence <patrick@pkspence.com> wrote:

Jatinder Singh wrote:
> I could use Database class of DAO by writing following code,
>
> accessApp = WIN32OLE.*new*('Access.Application')
>
> *accessDB* = accessApp.CurrentDb()
>
> accessDB is an instance of DAO.Database class.
>
> But is there a way I could use DAO directly?
>
> Regards,
>
> Jatinder

Just out of curosity... *why* do you want to use DAO?

--
Posted via http://www.ruby-forum.com/\.