111,097
社区成员




using System.Data.SqlClient;
string str = "Data Source=.;Initial Catalog=student;Integrated Security=SSPI"; //数据库连接语句
SqlConnection connection = new SqlConnection(str); //连接数据库
connection.Open(); //打开数据库连接
string sql = "update useinfo set use='" + textBox11.Text + "',pwd='" + textBox12.Text where use='" + textBox11.Text + "'"; //数据库update命令
SqlCommand command = new SqlCommand(sql, connection);
command.ExecuteNonQuery();
connection.Close();
MessageBox.Show("修改成功!");