Call MYSQL stored procedure through c# -
i trying call mysql stored procedure through c# keeps giving me error saying
"you have error in sql syntax; check manual corresponds mysql server version right syntax use near ''55\'', 'useremail','username@company-it.pk\''' @ line 1 "
sp takes 3 input parameters user_id, preferences_key , preferences_value. have checked sp executing through mysql works want excute through c#. below code.
mysqlcontext = new mysql_otrsentities(); var userid=mysqlcontext.users.where(x=>x.login==agent.login).select(x=>x.id).firstordefault(); mysqlparameter param1 = new mysqlparameter("@user_id", agent.id); param1.mysqldbtype = mysqldbtype.int32; mysqlparameter param2 = new mysqlparameter("@preferences_key", "useremail"); param2.mysqldbtype = mysqldbtype.varchar; mysqlparameter param3 = new mysqlparameter("@preferences_value", agent.login); param3.mysqldbtype = mysqldbtype.longblob; mysqlcontext.database.executesqlcommand("call insertuserpreferences @user_id, @preferences_key,@preferences_value", param1, param2,param3);
Comments
Post a Comment