Wrox Home  
Search P2P Archive for: Go

  Return to Index  

access_asp thread: Updating field with current date


Message #1 by "SpyderJonz" <ajjones13@m...> on Mon, 3 Jun 2002 15:13:34
I am trying to update the date field in Access

objRS "UPDATE profiles set datelast = date() where NTUserID = 'JonzA09'"

Gets the following error:

Microsoft VBScript runtime error '800a01c2' 

Wrong number of arguments or invalid property assignment 

Cheers,
AJ

Message #2 by "Ken Schaefer" <ken@a...> on Tue, 4 Jun 2002 08:32:54 +1000
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: "SpyderJonz" <ajjones13@m...>
Subject: [access_asp] Updating field with current date


: I am trying to update the date field in Access
:
: objRS "UPDATE profiles set datelast = date() where NTUserID = 'JonzA09'"
:
: Gets the following error:
:
: Microsoft VBScript runtime error '800a01c2'
:
: Wrong number of arguments or invalid property assignment

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

objRS I assume is an ADO Recordset object.

If so, then you either need to:
a) assign a value to a property of the object
b) call a method of the object

You can't do what you're doing at the moment. If you want to pass an SQL
statement to a database, then you use the .Execute method of the ADO
Connection object:

<%
' Assumes you are using Access
' If using SQL Server, then use GetDate()
strSQL = _
    "UPDATE Profiles " & _
    "SET DateLast = Date " & _
    "WHERE NTUserID = 'JonzA09'"

Set objConn = Server.CreateObject("ADODB.Connection")

' Call .Open method, passing in connection string
objConn.Open strDBConnect

' Call .Execute method, passing in SQL statement
objConn.Execute strSQL,,adCmdText+adExecuteNoRecords

' Call .Close method
objConn.Close

' Deference
Set objConn = Nothing
%>

Cheers
Ken


  Return to Index