MySQL Forums :: MySQL for Visual Studio :: User variable in query - syntax

Advanced Search

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

Subject Views Written By Posted
User variable in query - syntax 868 Peter Benovic 03/23/2016 10:12AM
Re: User variable in query - syntax 385 Luis Penunuri 03/29/2016 04:12PM
Re: User variable in query - syntax 377 Peter Benovic 03/30/2016 07:09AM

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.