mysql - C# SQL : update with params - getting 0 and without the text -


i making databasemanager class solution , getting number 0 when trying update text. example : have name michael , wanted change "michael , mike" i'll use update.

public void addcrime(csteamid id, string crime, string time) {     try     {         mysqlconnection connection = createconnection();         mysqlcommand command = connection.createcommand();         crime = "," + crime;         command.commandtext = "update `" + main.instance.configuration.instance.databasetablename           + "` set `crime` = crime + ( @crime ) `steamid` = @steamid; select `crime` `"           + main.instance.configuration.instance.databasetablename           + "` `steamid` = @steamid";         command.parameters.addwithvalue("@steamid", id);         command.parameters.addwithvalue("@crime", crime);         connection.open();         command.executenonquery();         connection.close();         addtime(id, time);     }     catch (exception ex) { logger.log(ex); } } 

how call :

databasemanager.addwanted(player.csteamid, command[1], command[2]); 

thanks everyone!

yor last sentence in command select statement, nonquery not return values, number of rows affected. change executescalar , store value of select in variable.

second error data type of parameter @steamid. set value id, declares csteamid id... cstreamid not string, change addwithvalue


Comments

Popular posts from this blog

inversion of control - Autofac named registration constructor injection -

verilog - Systemverilog dynamic casting issues -

ios - Change Storyboard View using Seague -