My question is quite similar to already answered ones but yet not. I\'d like some help sorting this out.
I\'m trying to add data to a database table but I get keepin
I found the solution to this problem by making an extensive Google search for undefined parameters in MySQL. This article (MySql.Data.MySqlClient.MySqlException: Parameter ‘@id’ must be defined) covers the basics of the problem. It's as far as I understand related to an upgrade of the connector.
You need to add Allow User Variables=True
in the connection string in order to use custom variables. Pretty simple solution to an equally tough problem. ;)
The error is very much informative, you are just using @myLeft
parameter in your query without defining it. you ned to define that parameter like the others you have done.
objCmdInsert.Parameters.Add("?myLeft",...
Can you try:
objCmdInsert.Parameters.Add("@myLeft", MySqlDbType.Int).Value = 1212;
You probably have to do it for EACH occurrence of that parameter.
It's not clear to me what's the meaning of SET @myLeft := lft;
(You are trying to assign column value to parameter)
Before using @myLeft, you need to declare it. For example, assuming @myLeft is an INT:
DECLARE @myLeft INT;