win32ole adodb.command AffectedRows howto?

L

Lutz Mueller

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top