i am trying to run this query in c# winforms application,
NOTE: @ob is not a parameter it is a MySQL Variable which stores the value from first query and in turn serves the same value to second query,
the query is working fine on MySql Directly.
but when i run the same in my Program it throws an error
Fatal Error Encountered During Command Execution
string querystring = "SET @ob = (SELECT (Opening_Balance + Total_Income - Total_Expences) FROM transaction_master WHERE Date < '2014-10-09' ORDER BY Date DESC LIMIT 1); INSERT INTO `transaction_master`(`Date`, `Opening_Balance`, `Total_Income`, `Total_Expences`) VALUES ('2014-10-09',IFNULL(@ob,0),'1000','0');"
db.Open();
cmd.CommandText = querystring;
cmd.Connection = db;
cmd.ExecuteNonQuery();
db.Close();
Please Help me with this problem.