navigation
a webmaster learning community
     Home    Register     Search      Help      Login    
Sponsors

Shopping Cart Software
Ecommerce software integrated into Frontpage, Dreamweaver and Golive templates. No monthly fees and available in ASP and PHP versions.

Website Templates
We also have a wide selection of Dreamweaver, Expression Web and Frontpage templates as well as webmaster tools and CSS layouts.

Frontpage website templates
Creative Website Templates for FrontPage, Dreamweaver, Flash, SwishMax

Search Forums
 

Advanced search
Recent Posts

 Todays Posts
 Most Active posts
 Posts since last visit
 My Recent Posts
 Mark posts read

Microsoft MVP

 

Need help updating a record

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
Printable Version 

All Forums >> Web Development >> ASP and Database >> Need help updating a record
Page: [1]
 
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.

(in reply to RogC)
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

(in reply to rdouglass)
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.

(in reply to RogC)
RogC

 

Posts: 3
Joined: 1/30/2008
Status: offline

 
RE: Need help updating a record - 1/30/2008 13:16:27   
I have tried it and it now works, It has taken me a day and a half to work it out, but at least in the end I have got it working.

Silly really as it was staring me in the face as I use a session variable to display the username whilst they are logged in!!! :)

I will visit this forum again if I have any problems, it has certainly been a big help, rdouglas I salute you, it was your comment about how the data was being passed which put me in the right direction.

Thanks again!!!

Rog

(in reply to rdouglass)
Page:   [1]

All Forums >> Web Development >> ASP and Database >> Need help updating a record
Page: [1]
Jump to: 1





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