I believe I've connected to Microsofts' SQL Express, however, I'm stuck. I'm happy this succeeds! Using Windows XP, 1-Click Installer Ruby/Windows installation (1.86). Using ODBC, and SQLEXPRESS 2005. I can read all the columns in a row, but not individual columns with 'rows'. #--CODE-- require 'dbi' dbh= DBI.connect('DBI:ODBC:driver=SQL Server;server=ehcomp;database=my_project;uid=sa;pwd=password') rows= dbh.select_all('select projno,project,projshort from projects') puts rows # outputs the three columns on row 0 dbh.disconnect #---END CODE--- How do I output individual columns with rows? A lot of things are additionally problematic, like 'fetch' returns an error, 'execute' returns a 'garbage collection' error. I've got this far using 'select_all'. Is there a windows/ruby/ODBC/SQL server online help somewhere?
on 2008-11-24 21:43
on 2008-12-01 05:53
Though I posted on this forum, I found a valuable answer serendipitiously on a Google Forum. Apparently this forum automatically posts material on Google's forum. Yet the answer is directed to me. Thanks Aldric! I was using rows[0,0], which didn't work. Your rows works well. From: Aldric Giacomoni <"aldric[removeme]"@trevoke.net> Date: Sat, 29 Nov 2008 09:45:11 +0900 Local: Fri, Nov 28 2008 7:45 pm Subject: Re: ODBC, 'Sql server', XP: beyond connection How about rows ? These two websites have been really useful for me: http://www.kitebird.com/articles/ruby-dbi.html http://www.troubleshooters.com/codecorn/ruby/datab... Good luck! --Aldric