From: "Simon Kröger" Date: 2005-09-16T06:30:50+09:00 Subject: Re: MS Access Sean Armstrong wrote: > On 9/15/05, Phlip wrote: > >>Steve wrote: >> >> >>>I'm considering learning Ruby. I have no programming experience yet. I >>>was wondering if it's possibly to write applications in Ruby that can >> >>use >> >>>and change the data in my MS Access files. >> >>Absolutely. Database are designed to access a wide warehouse of data >>through >>a narrow interface. Narrow interfaces are easy to port to new languages. >>Ruby will see tables of data, just like Visual Basic or C++ will. >> >> > > Does anyone have any good code examples? The hardest thing for people like > Steve, and myself, is that the documentation for these items are very > limited and not very revealing to newbies. For instance, I could not find a > single code example for connecting to a SQL database, let alone Access, in > the Pickaxe book. So if anyone has any good code examples for manipulating > data in Access or MySQL, I would like to see it here. > > Thanks. > SA > Ok, this isn't 'good' but short and shows that it is realy easy to connect to ms access. ------------------------------------------------------------------- require 'dbi' DBI.connect("DBI:ODBC:driver=Microsoft Access Driver (*.mdb);"+ "dbq=C:/path/to/my/db.mdb") do |dbh| dbh.select_all('select * from myTable') {|row| p row} end ------------------------------------------------------------------- I guess it's so damm easy, nobody who figured it out writes HOWTO's. cheers Simon