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

MySQl + .Net Connector + Entity Framework Code First (no replies)

$
0
0
Hi,
I am totally new to MySql and the .net connector.

I have an MVC3 application using Entity Framework and Code First with Sql Server that I'm trying to migrate to using MySql. However, I seem to have hit a problem at the very first try.

I have the following procedure created in MySql to return a count.
CREATE PROCEDURE GetCount()
BEGIN
SELECT count(*)
FROM mytable;
END$$

I am trying to call this procedure in my app as
int count = myContext.Database.SqlQuery<int>("GetCount").First();

And it falls over with the error:

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

Why is this falling over? I can get the same syntax to work fine with Sql Server so I think it may be something with the .net connector. I can also execute the SP itself in MySql BTW. any help appreciated.
Thanks,

Viewing all articles
Browse latest Browse all 1451

Trending Articles



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