MySQL and C#.Net Stored Procedure and multiple parameter -


i developing (converting application db ms sql mysql) application using c#.net , mysql. c# code , stored procedure working perfect in ms sql when trying ingrate mysql getting parameter error. c# code below , mysql stored procedure running (tested in editor using call key work , parameter)

 public datatable alapvalidateuser(string email, string password,string type)     {         datatable dt = new datatable();         cmd = new mysqlcommand("useridvalidation");         cmd.commandtype = commandtype.storedprocedure;         cmd.connection = cnn;         string pass = reencryptpassword(password);          mysqlparameter pramemail = new mysqlparameter("@v_emailid", email);         pramemail.direction = parameterdirection.input;         cmd.parameters.add(pramemail);          mysqlparameter prampassword = new mysqlparameter("@v_password", pass);         prampassword.direction = parameterdirection.input;         cmd.parameters.add(prampassword);          mysqldataadapter adap = new mysqldataadapter(cmd);         if (cnn.state != connectionstate.open ||             cnn.state == connectionstate.broken ||             cnn.state != connectionstate.connecting ||             cnn.state != connectionstate.executing ||             cnn.state != connectionstate.fetching)             cnn.open();          adap.fill(dt);         cnn.close();         return dt;     } 

mysql stored procedure here:

create definer=`root`@`localhost` procedure `useridvalidation`(v_emailid national varchar(100),v_password  national varchar(50)) begin    select userid ,email,bloodgroup ,bloodgroupid,country countryslno ,countryname ,state ,district ,location,fname,lname ,donortype ,lastlogin ,validated ,profileimage       ,maritalstatus ,sex ,height ,weight  ,healthstatus       ,myfilelocation vwuser email = v_emailid ,    password = v_password , validated = 'y'; end$$ 

during execution exception below:

"incorrect number of arguments procedure alap.useridvalidation; expected 2, got 1"

can please me find out error.

update: mysql connector v.6.6.5. have checked in debug mode in c# parameter correct , can see both paramter in command object. next trying filling adapter hence command object passing mysql connector , there paramter missing. have tried add same 1st parameter creating 3rd line gettinng error same paramter exist. test sure purely mysql or mysql connector bug. dont know how bug can exists in such db many people using mysql. suman

this bug of sql , have received solution mysql team. have implemented changes in mysql stored procedure , got solution. mysql reply below

hi suman,

i have reproduced issue described, , exists workaround works fine , keep speed in migration mysql. problem here national usage in definition of parameters routine. if want define particular character set can define routine this:

create definer=`root`@`localhost` procedure `useridvalidation`(v_emailid varchar(100) ***character set utf8***,v_password varchar(50) character set utf8) begin .... rest of code 

or can use

create definer=`root`@`localhost` procedure `useridvalidation`(v_emailid varchar(100),v_password varchar(50)) begin     .... 

the default character set in server utf8 , equivalent national according documentation.

you can check more information here:

http://dev.mysql.com/doc/refman/5.5/en/charset-national.html 

please let me know if workaround worked you.


Comments

Popular posts from this blog

Perl - how to grep a block of text from a file -

delphi - How to remove all the grips on a coolbar if I have several coolbands? -

javascript - Animating array of divs; only the final element is modified -