08-03-2013, 08:07 PM
"UPDATE bg_user SET user_id=", // missing after user_id=
this.textBox36.Text,
", passwd=",
this.textBox37.Text,
", cash=",
this.textBox45.Text,
", email=",
this.textBox42.Text,
" WHERE user_code=", // error missing
this.textBox43.Text, //an array does not end with ,
The result would be something like this :
UPDATE bg_user SET user_id=, passwd=, cash=, email= WHERE user_code=
Instead of using string.concat i suggest concatenating strings with + because 1 its much easier to use and is less memory usage(if the application were to execute a query every second it will allocate a lot of uses memory in a short time.)
A proper way to write it is simple:
string query = "UPDATE bg_user SET " +
"user_id=" + this.textBox36.Text + "," +
"passwd=" + this.textBox37.Text + "," +
"cash=" + this.textBox45.Text + "," +
"email=" + this.textBox42.Text + " " +
"WHERE user_code=" + this.textBox43.Text + "";
@ReturnKratos
The operator & is the string concatenation for visual basic, it will not work in the other .net languages, instead of the operator & I suggest using the operator4 +, since it works in VB and other .net languages language, even outside .net like java or javascript, or python, etc

