I know it's been beat to death, but after setting up your named ODBC item
correctly, here is some n00b DBI code I wrote for easy query/outputting:
# Nathan Christie
require 'dbi'
db = DBI.connect( 'DBI:ODBC:MS_SQL_QA2' )
q = db.prepare( 'select top 100 * from inventory' )
q.execute()
a = Array.new()
while q.fetchable? do
a << q.fetch()
end
q.column_names.each do |i|
print( i + "\t" )
end
print( "\n\n" )
i = 0
while i < a.length()-1 do
j = 0
while j < a[ i ].length() do
print( a[ i ][ j ].to_s() + "\t" )
j += 1
end
print( "\n" )
i += 1
end
q.finish()
I never really did fully get Ruby's looping stuff :|
Hope this helps,
Nathan Christie
---------------------------------------------------------------------
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=6445&messageID=18410#18410
_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general