[Mono-list] Unknown column error when calling MySql stored procedure from Mono C#
gewe
gewe at hofmail.zzn.com
Sat Sep 6 11:34:11 EDT 2008
I have a MySql database, containing a table with two columns: day is a DATE
column, amount is DECIMAL(4,2).
I have the following stored procedure:
CREATE DEFINER=`root`@`localhost` PROCEDURE `insertdata`(IN p_day DATE, IN
p_amount DECIMAL(4,2))
BEGIN
INSERT INTO table1 (day, amount) VALUES (p_day, p_amount);
END
If I call this procedure from the MySql console, everything works. The
values are inserted into the table.
When I call this procedure from the following C# code, I get an "Unknown
column 'p_day' in 'field list'" error:
string connStr = "Server=localhost;Database=test;Uid=test;Pwd=*****;use
procedure bodies=false;";
MySqlConnection conn = new MySqlConnection(connStr);
conn.Open();
MySqlCommand dCmd = new MySqlCommand("verlof_toevoegen", conn);
dCmd.CommandType = CommandType.StoredProcedure;
dCmd.Parameters.AddWithValue("p_day", string.Format("'{0:yyyy-MM-dd}'",
DateTime.Now));
dCmd.Parameters.AddWithValue("p_amount", 9);
dCmd.ExecuteNonQuery();
I tried changing the parameter name, used a name without an underscore,
nothing helps.
What is causing the error?
--
View this message in context: http://www.nabble.com/Unknown-column-error-when-calling-MySql-stored-procedure-from-Mono-C--tp19347812p19347812.html
Sent from the Mono - General mailing list archive at Nabble.com.
More information about the Mono-list
mailing list