[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

Re: Using Ruby to get data from an Access Database

Ball, Donald A Jr (Library)

6/4/2007 6:09:00 PM

> The script would be running from the same machine as the
> database. I've used ADO before with Access Databases so i'd
> probably stick with what I know, bit stuck as to how I'd get
> the right syntax for Ruby, can't find exactly what i'm
> looking for out there on the web.....
>
> Dim adoCon
> Dim rsHouse
> Dim strSQL
> Set adoCon = Server.CreateObject("ADODB.Connection")
> Set rsHouse = Server.CreateObject("ADODB.Recordset")
> adoCon.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" &
> Server.MapPath("Rent_Management_System_V2.mdb")
> strSQL = "Select * From House"
> rsHouse.Open strSQl, adoCon
>
> Any idea how this sort of thing would work with Ruby (or
> where I could go to find out)

I use DBI with the ODBC DBD and do stuff like this:

DBI.connect("DBI:ODBC:driver=Microsoft Access Driver (*.mdb);
dbq=#{filename}") do |conn|
conn.select_all('SELECT * FROM Pools').collect {|row| row.to_h}.each
do |values|
pools[values['Key']] = values
end
end

- donald