Dorababu Meka

Dorababu Meka

  • 230
  • 8.3k
  • 1.7m

Only MySqlParameter objects may be stored

Dec 10 2012 6:23 AM
Hi all I have a written a sample code to insert in to mysql database using 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);

But I am getting an exception as Only MySqlParameter objects may be stored can some one help me..

Answers (4)