Uma Geller
6/5/2007 6:41:00 AM
> Step 2. How do I connect to an Access Database to gather my URLs ?
> In the past i've used ADO to connect to an MS Access database
begin
require 'win32ole'
rescue LoadError
puts 'no win32ole available'
exit(1)
end
conn = WIN32OLE.new('adodb.connection')
table = WIN32OLE.new('adodb.recordset')
conn.open " DBQ=mydatabase.mdb; DRIVER={Microsoft Access Driver (*.mdb)};"
sql = "SELECT URL FROM ADDRESSBOOK"
table.open( sql, conn )
while not table.EOF
rows = table.GetRows(1)
p rows
end
# or, if you prefer, retrieve all rows in a single pass
#table.MoveFirst
#p table.GetRows
> Step 3. How would I insert the results back into the database ?
same as before, but using INSERT instead of SELECT
best regards,
UG