尝试使用以下方法更新一列。没有例外,但数据库没有更新。
OleDbConnection conn = new OleDbConnection(@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Saumil\Projects\NewProj\LoginInfo.accdb");
conn.Open();
OleDbDataAdapter da = new OleDbDataAdapter("Select * from UserInfo", conn);
DataSet dss = new DataSet();
da.Fill(dss, "UserInfo");
OleDbCommand cmd = new OleDbCommand("UPDATE UserInfo SET [Password] = @Password WHERE UserName = 'MyName'", conn);
cmd.Parameters.AddWithValue("@Password", txtBoxPassword.Text);
da.UpdateCommand = cmd;
da.UpdateCommand.ExecuteNonQuery();
conn.Close();