|
| |
|
|
RogC
Posts: 3 Joined: 1/30/2008 Status: offline
|
Need help updating a record - 1/30/2008 7:10:13
I am updating a basic asp forum, which works, I have created and wonder if the following is possible. I have added two fields in the topic list table in the database, one for the username (LastUSer) and one for the date (LastTime) in which the last reply to the post was updated. The reply section works and creates a new record for the reply post in the reply, but I want to update the record in the topic list table so that the Last User and Last Time fields are updated with the appropiate details. After posting the reply, in which the record is added, I have redirected to another page so that I can update the Topic table with the last updated details but I get the following message: Microsoft OLE DB Provider for ODBC Drivers error '80040e14' [Microsoft][ODBC Microsoft Access Driver] Extra ) in query expression '(ID = )'. The code I use is: <% ID=request("ID") %> <% LASTUSER=request("LastUser") %> <% LASTTIME=request("LastTime") %> <% Dim DataConn Dim CmdUpdateRecord Dim MYSQL Set DataConn = Server.CreateObject("ADODB.Connection") Set CmdUpdateRecord = Server.CreateObject("ADODB.Recordset") DataConn.Open "DBQ=" & Server.Mappath("../database/forum.mdb") & ";Driver={Microsoft Access Driver (*.mdb)};" MYSQL = "SELECT Topic.* FROM Topic WHERE (ID = " & ID & ")" CmdUpdateRecord.Open MYSQL, DataConn, 1, 3 CmdUpdateRecord.Fields("LastUser") = LASTUSER CmdUpdateRecord.Fields("LastTime") = LASTTIME CmdUpdateRecord.Update CmdUpdateRecord.Close Set CmdUpdateRecord = Nothing DataConn.Close Set DataConn = Nothing %> The LastUser and LastTime details are hidden fields that I have attached to the form. Any Ideas?
|
|
|
|
rdouglass
Posts: 9167 From: Biddeford, ME USA Status: offline
|
RE: Need help updating a record - 1/30/2008 12:29:12
Hi and Welcome to OutFront quote:
expression '(ID = )'. That kinda' indicates you're not picking up the Request("id"). Where exactly are you grabbing that from, the form? quote:
...after posting the reply, in which the record is added, I have redirected to another page ... Are you passing it somehow during that redirect?
_____________________________
Don't take you're eye off your final destination. ASP Checkbox Function Tutorial.
|
|
|
|
RogC
Posts: 3 Joined: 1/30/2008 Status: offline
|
RE: Need help updating a record - 1/30/2008 12:43:20
I was using a hidden variable from the form, but after the record was added, I don't think the value was being carried through. I have just read about Session Objects, and may be able to set a session variable to carry from the message board, through to this page after the form. The code itself works, as I put it on the reply page, but the record could be updated and then the user could have cancelled out of a reply and the data on the topic list would have been wrong. I am going to give the sessions a try now I have read about them. Does this mean that I would call the information like so: <% LASTUSER=Session("LastUser") %> instead of <% LASTUSER=request("LastUser") %> ? Thanks for the reply
|
|
|
|
rdouglass
Posts: 9167 From: Biddeford, ME USA Status: offline
|
RE: Need help updating a record - 1/30/2008 13:00:13
quote:
<% LASTUSER=Session("LastUser") %> instead of <% LASTUSER=request("LastUser") %> Looks accurate to me.
_____________________________
Don't take you're eye off your final destination. ASP Checkbox Function Tutorial.
|
|
New Messages |
No New Messages |
Hot Topic w/ New Messages |
Hot Topic w/o New Messages |
Locked w/ New Messages |
Locked w/o New Messages |
|
Post New Thread
Reply to Message
Post New Poll
Submit Vote
Delete My Own Post
Delete My Own Thread
Rate Posts
|
|
|