Web Connection
wwSql - nAffectedRecords when Executing "DELETE" command
Gravatar is a globally recognized avatar based on your email address. wwSql - nAffectedRecords when Executing "DELETE" command
  Matt Slay
  All
  Jan 18, 2017 @ 04:57pm

Rick - the wwSql.nAffectedRecords property always returns 0 when executing a Sql DELETE command against Sql Server.

Your code in wwSql.Execute() has this:

...
This.nAffectedRecords = aCountInfo[1, 2]  &&RECCOUNT()
...

But, when executing a Sql DELETE command against Sql Server, this always evaluates to zero, instead of telling you how many records were deleted.

Here is an example of the Sql command I am passing to wwSql.Execute()

lcSql = "Delete from ScheduleItems Where PurchaseOrderItem_id In (99796, 98422, 96321)"

lnReturn = loSql.Execute(lcSql)
Gravatar is a globally recognized avatar based on your email address. re: wwSql - nAffectedRecords when Executing
  Rick Strahl
  Matt Slay
  Jan 19, 2017 @ 12:42am

Then something has changed with the way the ODBC driver is returned the affected record count. The value is supposed to come back as part of the acountinfo[] array. If it's not coming from there, the call to Execute might return the right number.

+++ Rick ---

Gravatar is a globally recognized avatar based on your email address. re: wwSql - nAffectedRecords when Executing
  Matt Slay
  Rick Strahl
  Jan 22, 2017 @ 02:33pm

Rick - my apologies... After futher testing, I can confirm your code is all working as expected.

I'm not sure what I was experiencing when I reported this error, but I find that I cannot reproduce the error.

Gravatar is a globally recognized avatar based on your email address. re: wwSql - nAffectedRecords when Executing
  Rick Strahl
  Matt Slay
  Jan 23, 2017 @ 03:32pm

LOL! That's a bit odd... glad to hear it's working because that code hasn't changed in many years and if it was broken it'd mean that ODBC or the SQL ODBC driver would be broken...

+++ Rick ---

© 1996-2024