MySQl + .Net Connector + Entity Framework Code First
Posted by: Chandini Paterson
Date: March 11, 2012 07:22AM

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,

Options: ReplyQuote


Subject
Written By
Posted
MySQl + .Net Connector + Entity Framework Code First
March 11, 2012 07:22AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.