Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

What's wrong with my code? 2

Status
Not open for further replies.

bilebalar

IS-IT--Management
Mar 25, 2002
386
US
Hi,

I am getting the following error.

ADODB.Recordset error '800a0bb9'

Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.

On the previous page, I have an INPUT variable called LastLogin. I want to put the value of LastLogin into my table called Researcher. The code works OK without LINE 3 but the thing is, it is updating the LastLogin column on the 1st line only. I have 15 different person in Researcher and I want LastLogin to be updated for the correct Researcher. What is wrong with my Filter statement? Thanks.

1 - Dim rsLG
2 - Set rsLG = Server.CreateObject("ADODB.Recordset")
3 - rsLG.Filter = "username = " & Request("username")
4 - rsLG.Open "Researcher", objConn, adOpenForwardOnly, adLockOptimistic, adCmdTable
5 - rsLG("LastLogin") = Request.Form("LastLogin")
6 - rsLG.Update
7 - rsLG.Close
8 - Set rsLG = Nothing
 
you are missing "'" around your request("username"),

try something like this

Code:
sql="update Researcher set LastLogin='" & Request("LastLogin") & "' where username='"&Request("username")&"'"
objConn.execute(sql)
 
if you still want to use the ado method then you need to tell the database WHERE to go just like stevens statement...
Also, not sure if you are using GET or POST...looks like you mixed up the 2 so I used POST

stevens code is prefered since you don't open a recordset up; however, this does fine and looks like it's what you use

good luck

Code:
<%
  Dim username, lastlogin, objRS, objConn, strConn

  username = Request.Form("username")
  lastlogin = Request.Form("LastLogin")  

  Set objConn = Server.CreateObject("ADODB.Connection")
  Set objRS = Server.CreateObject("ADODB.Recordset")
  FilePath = Server.MapPath("researchers.mdb")
  strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="  & FilePath & ";" 
  objConn.Open strConn

  strSQL="SELECT LastLogin, UserName FROM Researcher WHERE  UserName='" & username & "';"
  objRS.Open strSQL, objConn, 3, 3
  
  objRS("LastLogin") = lastlogin
  objRS.Update

  objRS.Close
  SET objRS = Nothing
  objConn.Close
  SET objConn = Nothing
%>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top