MySQL Forums
Forum List  »  MySQL for Visual Studio

User variable in query - syntax
Posted by: Peter Benovic
Date: March 23, 2016 10:12AM

I have a query in my application that uses a user variable. At runtime MySQL returns an error. Here is the query:

dbCmd.CommandText = "UPDATE kassenbewegungen t CROSS JOIN (SELECT @s := ?StartVal) param " & _
"SET t.Kassastand = (@s := (@s + t.EinlageEntnahme)) WHERE t.KassaID = ?KassaID;"
dbCmd.Parameters.AddWithValue("?StartVal", StartVal) '
dbCmd.Parameters.AddWithValue("?KassaID", KassaID)

So the paramters to the query ar ?StartVal and ?KassaID. Nevertheless MySQL claims that parameter @s has no value. What is the syntax for using user variables in queries throu .NET Connector?

Options: ReplyQuote

Written By
User variable in query - syntax
March 23, 2016 10:12AM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.