I have a problem with this MySQL command:
cmdTemp = New MySqlCommand("SET @qty = " & Qty & "; update(tb_harvest) set actual = (case when @qty >= actual " & _
"then if(@qty := @qty - actual, 0, 0) when (@tmp := actual - @qty) " & _
"then if(@qty := 0, @tmp, @tmp) " & _
"else actual end), Status = (case when @qty >= actual then if(@qty := @qty - actual, 0, 0) " & _
"when (@tmp := actual - @qty) then if(@qty := 0, 1, 1) else 1 end) order by harvestid;", cn)
When I try to run in VB.NET (VS2008) I get the following error:
@Qty
must be defined so do@tmp
However when I run this on MySQL(HeidiSQL) it doesn't have problem.
When I add into the New ConnectionString
, Allow User Variables = true
the error is:
Keyword not supported. Parameter name: allowuservariables
This is my ConnectionString
which I put together using Connection Strings:
Server=localhost;Port=3306;Database=testing;Uid='test';Pwd='test';AllowUserVariables=True;
I am using MySQL Version 5.6.21