Using the CS0120 superview to execute a SQL transaction

If I use a transaction that has two statements in it, only the first statement executes
In the example below only the UPDATE statement executes and I am not able to retrieve the result


csUpdateW.Browse "BEGIN TRANSACTION; " & _
  "UPDATE OWID SET LASTVALUE = LASTVALUE + 1; " & _
  "SELECT LASTVALUE FROM OWID; " & _
  "COMMIT TRANSACTION;", True
csUpdateW.InternalSet 256

Do While csUpdateW.Fetch
  resultval = csUpdateW.Fields(0).Value
Loop
csUpdateW.Close

I am trying to use the superview instead of an ADO connection for various reasons.

Any suggestions are appreciated, thank you.

Parents
  • 0

    Update transactions have no results.

  • 0 in reply to Jay Converse Acumen

    Thanks Jay; I know that update statements have no results but the transaction also contains a select statement which does not seem to execute . If I put the select statement first then it executes it and it gives me the result  but it does not execute the Update statement.

    I would like both executed, ideally in this order : update first and then SELECT and then get the results of the select statement

    If I use the transaction as it is in SQL server management studio I executes the update statement and then gives me the result of the select statement

    The same SQL transaction used through the CS0120 executes only the first statement in the transaction.

Reply
  • 0 in reply to Jay Converse Acumen

    Thanks Jay; I know that update statements have no results but the transaction also contains a select statement which does not seem to execute . If I put the select statement first then it executes it and it gives me the result  but it does not execute the Update statement.

    I would like both executed, ideally in this order : update first and then SELECT and then get the results of the select statement

    If I use the transaction as it is in SQL server management studio I executes the update statement and then gives me the result of the select statement

    The same SQL transaction used through the CS0120 executes only the first statement in the transaction.

Children