Thanks David.
I will test it soon. However, here’s another question: I remember when I
used ADO in ASP web application, I can use ADODB.Connection without using a
DSN. In another word, ADO is completely independent from ODBC, and it should
be at a lower level. If I didn’t misunderstand, the CONNSTR in your sample
code should be an ADO connection string without the need to setup a DSN in
ODBC manager, right?
The win32ole module is built into the interpretor so that we don’t need to
use a .so or .dll?
Thanks,
Shannon
···
From: davem1957@yahoo.com (David Moore)
Reply-To: ruby-talk@ruby-lang.org
To: ruby-talk@ruby-lang.org (ruby-talk ML)
Subject: Re: exerb
Date: Fri, 29 Nov 2002 22:36:51 +0900“Shannon Fang” xrfang@hotmail.com wrote in message
news:F183ROXIYPLzrOvyxOH0001a893@hotmail.com…hi
anyone used exerb? I tired with my program it worked fine. However, if I
use
ODBC in my program, the created exe doesn’t work. I guess it don’t know
where to look for odbc.o… Any suggestion?I had the same problem. I worked around it on my windows system by
using ADO and Win32OLE. Here is a little sample code.require “win32ole”
the Ado com object ID string
ADO_OBJECT1 = ‘ADODB.Connection’
ADO_OBJECT2 = ‘ADODB.RecordSet’CONNSTR = ‘Your DSN’
TESTTABLE1 = ‘Your Table Name’
SAMPLEFIELD = ‘Your Field’stop after
MAX_RECS = 100
def adoTest1()
instantiate
handle = WIN32OLE.new(ADO_OBJECT1)
invoke Ado
handle.Open(CONNSTR)
sql = “SELECT TOP #{MAX_RECS} * FROM #{TESTTABLE1}”
puts sql
recordSet = handle.Execute(sql)
iterate data-set
while !recordSet.EOF index = 0 # access the fields collection theName = recordSet.Fields(index).Name() theSize = recordSet.Fields(index).ActualSize() print "Field #{index}(#{theName}) is size #{theSize}\n" theValue = recordSet.Fields().Item(SAMPLEFIELD).Value() print "Value of #{SAMPLEFIELD} is #{theValue}\n" recordSet.moveNext
end
handle.Close()
end
STOP MORE SPAM with the new MSN 8 and get 2 months FREE*
http://join.msn.com/?page=features/junkmail