Wednesday 15 April 2015

c# - Input string was not in a correct format error in MySQL query -



c# - Input string was not in a correct format error in MySQL query -

hi working on application works mysql database , c# 4.0.

i have below method update mysql table. while executing below method getting error input string not in right format.

method call:

updateonline(mcon, convertedxml, filename, stmid);

method definition:

private void updateonline(mysqlconnection mcon, string convertedxml, string filename,int stmtid) { var cmd = new mysqlcommand("update user_account_statement set statement_xml=@xml,"+ " file_name=@fname, status='closed' statement_id=@stmtid",mcon); cmd.parameters.addwithvalue("@xml", mysqldbtype.longtext).value = convertedxml; cmd.parameters.addwithvalue("@fname", mysqldbtype.varchar).value = filename; cmd.parameters.addwithvalue("@stmtid", mysqldbtype.int32).value=stmtid; var query = cmd.tostring(); cmd.executenonquery(); }

i checked many times info types , not able figure out missing.

update

table schema below:

create table `user_account_statement` ( `statement_id` int(10) unsigned not null auto_increment, `statement_xml` longtext not null, `status` varchar(10) not null, `file_name` varchar(60) not null, primary key (`statement_id`) ) engine=myisam auto_increment=1084 default charset=latin1;

take @ parameters bud . . in query string says, @xml, @fname, @stmtid

then lines addwithvalue, code says @xml, @filename, @stmtid

c# mysql sql-update query-string

No comments:

Post a Comment