Quantcast
Channel: MySQL Forums - Connector/NET and C#, Mono, .Net
Viewing all articles
Browse latest Browse all 1451

DateTime error (no replies)

$
0
0
Hi,
I have a stored procedure taking in a datetime parameter as follows:

CREATE DEFINER=`root`@`localhost` PROCEDURE `p5`(inizio DATETIME)
BEGIN
SELECT * FROM allottment WHERE dal > inizio;
END

My C# code is as follows:

MySqlCommand oCmd = new MySqlCommand("p5", sqlConn);
oCmd.Parameters.Add("inizio", MySqlDbType.Datetime).Value = "2007-03-25";// new DateTime(2008, 4, 12, 18, 17, 15); DateTime.Now;
MySqlDataAdapter adapter = new MySqlDataAdapter(oCmd);
adapter.Fill(ds);

But when run the following exception occurs:

#42000You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'p5' at line 1

I have tried the parameter value as a DateTime as well as a string. No luck.
I am using MySQl 5.1 with Workbench 5.2.28CE.

Please help.

Viewing all articles
Browse latest Browse all 1451

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>