I have written a sample code to insert data into MySQL database using a Stored Procedure along with Entity Framework as follows:
MySqlParameter userName = new MySqlParameter("_UserName", MySqlDbType.VarChar);
userName.Value = txtUserName.Text;
MySqlParameter password = new MySqlParameter("_Password", MySqlDbType.VarChar);
password.Value = txtPassword.Text;
MySqlParameter FirstName = new MySqlParameter("_FirstName", MySqlDbType.VarChar);
FirstName.Value = txtFirstName.Text;
MySqlParameter LastName = new MySqlParameter("_LastName", MySqlDbType.VarChar);
LastName.Value = txtLastName.Text;
entities.ExecuteStoreCommand(
"uspInsertUsers _UserName,_Password,_FirstName,_LastName",
userName, password, FirstName, LastName);
I am getting an Exception:
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 ‘uspInsertUsers ‘Dorababu’,’sae’,’Dorababu’,’M” at line 1
Can some one help me?
Finally this works for me