Win32ole adodb.command AffectedRows howto?

Greetings,

I’ve been trying something along these lines:

connstr = “Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=#{MDB_FILE};Persist Security Info=False”
oconn = WIN32OLE.new(‘ADODB.Connection’)
oconn.Open(connstr)

#(this works fine so far)

sql = ‘update mytable set field1=“test” where ID=1’
ocmd = WIN32OLE.new(‘ADODB.Command’)
ocmd.CommandType = ADCMDTEXT
ocmd.ActiveConnection = oconn
ocmd.CommandText = sql

#(now, we need a return value, according to spec.
#http://msdn.microsoft.com/en-us/library/ms681559(v=VS.85).aspx
#Also relevant: http://support.microsoft.com/kb/195048

affectedrows= 0
ocmd.Execute(affectedrows)

(great, returns without errors, now let’s check our integer

puts affectedrows

Result: cannot seem to get the number of updated rows back.
I did a few experiments with ADODB.Connection and its Execute method,
cannot
get a result back, either. I’ve done numerous searches for this little
detail, no luck - I’m stumped.

I’d be most grateful to hear back from anyone who has found a way to
return these integers back through winole32.

Thanks a bunch,

Luke

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs