ADODB.Recordset错误'800a0bcd'经典ASP

时间:2015-01-08 16:25:55

标签: html mysql oracle asp-classic

ADODB.Recordset错误'800a0bcd'

BOFEOF为True,或者当前记录已被删除。请求的操作需要当前记录。

  

/login/reset_form.asp,第8行。第8行是rs.MoveFirst

DIM mySQL, objRS, rs
mySQL = "SELECT * FROM medacist_user WHERE username = '" & strUsername & "'"
Set objRS = Server.CreateObject("ADODB.Connection")
objRS.Open  "Provider=MSDASQL.1;Password=****;Persist Security Info=True;User ID=****;Data Source=****"
Set rs = objRS.Execute(mySQL)

rs.MoveFirst
rs("Password") = Request.Form("Password")
rs("DateLastUpdated") = Date()
rs.Update

objRS.Close
Set objRS = Nothing

Response.Write "<div align='center'>" & strUsername & ",<br>"
Response.Write " Your password has been succesffully updated in our database.<br><br>"

objRS.Close
Set objRS = Nothing
objCONN.Close
Set objCONN = Nothing

1 个答案:

答案 0 :(得分:1)

如果您要更新记录,则不需要记录集,因为您不需要显示任何数据。只需使用更新查询,例如

mySQL = "UPDATE medacist_user set Password = "& Request.Form("Password") &", Date = "& Date() & " WHERE username = '" & strUsername & "'"
objRS.Execute(mySQL)

如果您还没有这样做,那么您需要考虑阻止两个或更多用户使用相同的用户名