Forums

This topic is locked

Passing Values

Posted 14 Oct 2002 10:01:45
1
has voted
14 Oct 2002 10:01:45 Derran Williams posted:
Can any one help? I have created a insert page in Dreamweaver MX using ASP. I want to be able to hit the insert page and allow it to view the record just entered and a detail page. I dont know how to tell it to go to last record in the table. any one help?

cheers Derran

Replies

Replied 14 Oct 2002 12:12:26
14 Oct 2002 12:12:26 Owen Eastwick replied:
What DB are you using Access, SQL Server, something else?

If you are using SQL Server you can use SELECT @@Identity, if it's Access then it it's a bit of a pain.

Regards

Owen.

Multiple Parameter UD4 / Access 2000 Database Search Tutorial:
www.tdsf.co.uk/tdsfdemo
Replied 14 Oct 2002 14:25:43
14 Oct 2002 14:25:43 Stuart Harland replied:
Found this a while ago...give it a try

< %
objRS.AddNew

'Get the autonumber as soon as the record is added, before you insert any other data
vMessageID = objRS("MessageID"

'now add you data.
objRS("MessageTitle" = Request("MessageTitle"
objRS("MessageText" = Request("MessageText"
objRS("ForumID" = vMessageID ' this does work
objRS("MessageOrigin" = Request("MessageOrigin"
objRS("MessageDate" = Now()
objRS("MessageLastUpdate" = Now()

objRS.Update

' Then you can redirect to a page to display this new record
response.redirect "displayPage.asp?ID=" & vMessageID
% >

Hope it helps,
Stuart

********************
wheatNOTmeat
Replied 14 Oct 2002 15:02:41
14 Oct 2002 15:02:41 Derran Williams replied:
in in ms access, i take it not very easy then?
Replied 16 Oct 2002 18:39:30
16 Oct 2002 18:39:30 Ned Frankly replied:
Derran,

Check this link. It has a complete tutorial on the exact issue you describe.

www.flws.com.au/showusyourcode/codeLib/code/AddNew.asp?catID=3

Ned Frankly
Replied 28 Oct 2002 10:57:56
28 Oct 2002 10:57:56 ed p replied:
just sort the recordset by the unique ID in descending order... easy!

Edited by - edp on 28 Oct 2002 10:58:53
Replied 28 Oct 2002 16:22:06
28 Oct 2002 16:22:06 Ned Frankly replied:
edp, that works unless you have more than one person updating the database at the same time. You can't always guarantee this is true on an ecom site, especially a busy one. I never want to take the chance of presenting the wrong user with someone else's activity results.

SELECT MAX(RecordID) will return only a single record with the highest RecordID (reduces server overhead because you don't have to store the entire table, just the single item you are interested in).

Ned Frankly
Replied 30 Oct 2002 16:05:56
30 Oct 2002 16:05:56 Derran Williams replied:
all sorted with this one chaps, many thanks for your help, your a star

derran

Reply to this topic