Insert in to mysql table using stored procedure entity framework

doockycox

New Member
Hi all I am using entity framework along with asp.net and mysql. I have created a sample table with \[code\]UserName\[/code\],\[code\]Password\[/code\],\[code\]FirstName\[/code\] and \[code\]LastName\[/code\]. I write a routine to insert in to the table as follows\[code\]CREATE DEFINER=`root`@`%` PROCEDURE `uspInsertUsers`(_UserName varchar(50),_Password varchar(50),_FirstName varchar(50),_LastName varchar(50))BEGINinsert into users(UserName,Password,FirstName,LastName)values(_UserName,_Password,_FirstName,_LastName);END\[/code\]I integrated my table along with routine in to my \[code\]edmx\[/code\] file. Now can some one tell how can I insert values in to the table using the routine i created or can some one tell how can I map the value parameters to routine as per we do in \[code\]SQL\[/code\]
B9cXo.png
I tried some thing like as follows\[code\] mysqlDBEntities cb = new mysqlDBEntities(); MySqlParameter stations = new MySqlParameter { ParameterName = "UserName", Value = "http://stackoverflow.com/questions/13777849/Dora", MySqlDbType = MySqlDbType.VarChar }; var parameters = new object[] { stations }; var results = cb.ExecuteStoreQuery<user>("exec uspInsertUsers _UserName", parameters);\[/code\]But getting an exception as \[code\]Only MySqlParameter objects may be stored\[/code\]
 
Back
Top