string username = textBox1.Text.Trim();
string password1 = textBox2.Text.Trim();
string password2 = textBox3.Text.Trim();
string query;
query="update 帐号 set username="+ username +"' and password='"+ password1 +"' where username='"+ username +"' ";
SqlCommand sqlcomm=new SqlCommand(query,sqlConnection1);
sqlConnection1.Open();
sqlcomm.ExecuteNonQuery();
sqlConnection1.Close();sqlcomm.ExecuteNonQuery();未处理的“System.Data.SqlClient.SqlException”类型的异常出现在 system.data.dll 中。其他信息: 系统错误。
string password1 = textBox2.Text.Trim();
string password2 = textBox3.Text.Trim();
string query;
query="update 帐号 set username="+ username +"' and password='"+ password1 +"' where username='"+ username +"' ";
SqlCommand sqlcomm=new SqlCommand(query,sqlConnection1);
sqlConnection1.Open();
sqlcomm.ExecuteNonQuery();
sqlConnection1.Close();sqlcomm.ExecuteNonQuery();未处理的“System.Data.SqlClient.SqlException”类型的异常出现在 system.data.dll 中。其他信息: 系统错误。
这里是不是少了个'query="update 帐号 set username='"+ username +"' and
还有就是username="+ username +"'
应该是 username='"+ username +"'
少了个单引号
这样应该可以了把
这样应该可以了把
还有我看了例子上面是and .
我换成了逗号.就可以了
query="update 帐号 set username='"+ username +"' , password='"+ password1 +"' where username='"+ username +"'";