可以同时更新两个表中字段的值吗?
string sqlstr= "update users set ";
sqlstr+= "username= ' "+ username.Text + " ' ";
sqlstr+= "sex= ' " + sex.SelectedItem.Value + " ' ";
可是我的表格中还有 dep_name,这个字段在另一个表中(dep)
------解决方案--------------------比如你还要将表中id=10的dep_name更新为 'test ':
string sqlstr= " update users set ";
sqlstr+= " username= ' "+ username.Text + " ' ";
sqlstr+= " sex= ' " + sex.SelectedItem.Value + " ' ";
sqlstr+= " update dep set dep_name = 'test ' where id = 10 ";