From: Gavin Sinclair Date: 2004-03-04T00:49:20+09:00 Subject: Re: why are Hashes so unsorted? what's your solution? On Thursday, March 4, 2004, 2:34:44 AM, Daniel wrote: > If you use DBI, it *is* the key. > require "dbi" > dbh = DBI.connect(dsn,user,passwd) > sth = dbh.prepare("select sku, artistname, albumtitle, sold...") > sth.execute > while rec = sth.fetch > puts "SKU: " + rec["SKU"] > puts "Artist Name: " + rec["ARTISTNAME"] > # etc, etc... > end > sth.finish > dbh.disconnect I really must present the above code in a more Rubyish fashion for newbies who are watching: require "dbi" DBI.connect(dsn,user,passwd) do |dbi| dbh.select_all("select sku, artistname, albumtitle, sold...") do |row| puts "SKU: " + row["SKU"] puts "Artist Name: " + row["ARTISTNAME"] # etc, etc... end end :) Gavin