winforms - How i get value of cell in mysql database and let user enter a number and sum or subtract it to the value in database -


i have list of balance's in database.

the user enters id display data in datagridview , enter amount of money want withdraw in textbox.

how can balance , add money want withdraw , update data new balance?

string ^ constring="datasource=localhost;port=3306;username=root;password=1234 "; mysqlconnection ^ condatabase = gcnew mysqlconnection(constring); float h = float::parse(textbox1->text); float withdraw=0;  condatabase->open();  try{   withdraw = valueindatabase - h;   query = "update database.clientinfo set balance='" + withdraw + "' accountnum='" + this->accountnum_txt->text + "';";              mycmddtabase = gcnew mysqlcommand(query, condatabase);   myreader = mycmddtabase->executereader();      }     while (myreader->read())     { }     condatabase->close();   } 


Comments