From: Michael Neumann Date: 2002-07-09T17:37:19+09:00 Subject: Re: decent example of how to use DBI/ODBC On Tue, Jul 09, 2002 at 11:25:24AM +0900, kk wrote: > Hello, > > Can someone give me a simple example of how to parse through a > recordset using ruby's DBI module? I have looked through the > documentation but can't find what I want. I can create the handle, > return the table names etc but how I parse though records? I know how > to do this with python (easily using mxODBC, ado etc)...must be > missing something? I am on 1.6.7 on Win2k... You should have a look at the DBI specification at http://ruby-dbi.sf.net/DBI_SPEC.html. Here a simple example to output column "t" of all rows in table "test". DBI.connect("dbi:xxx:xxx", "user", "passwd") do |dbh| dbh.select_all("SELECT t FROM test") {|row| p row['t'] } end Regards, Michael