这是我用的membership提供程序里的的一个方法,为什么改密码时一直报错,我用vs设了断点
说是update的语句有错误,大家帮我看看,谢谢!
OleDbConnection conn = new OleDbConnection(connectionString);
OleDbCommand cmd = new OleDbCommand("UPDATE [" + tableName + "]" +
" SET Password = ?, LastPasswordChangedDate = ? " +
" WHERE Username = ? AND ApplicationName = ?", conn);
cmd.Parameters.Add("@Password", OleDbType.VarChar, 255).Value = EncodePassword(newPwd);
cmd.Parameters.Add("@LastPasswordChangedDate", OleDbType.DBDate).Value = DateTime.Now;
cmd.Parameters.Add("@Username", OleDbType.VarChar, 255).Value = username;
cmd.Parameters.Add("@ApplicationName", OleDbType.VarChar, 255).Value = pApplicationName;
int rowsAffected = 0;
try
{
conn.Open();
rowsAffected = cmd.ExecuteNonQuery(); //调试时说错误出在这里
}
catch (OleDbException e)
{
if (WriteExceptionsToEventLog)
{
WriteToEventLog(e, "ChangePassword");
throw new ProviderException(exceptionMessage + "1");
}
else
{
throw e;
}
}