Insert Record

This is a discussion on "Insert Record" within the Classic ASP section. This forum, and the thread "Insert Record are both part of the Program Your Website category.



 Subscribe in a reader

Go Back   Webforumz.com > Main Forums > Program Your Website > Classic ASP

Notices


Closed Thread
 
LinkBack Thread Tools
  #1  
Old Aug 23rd, 2004, 16:50
Junior Member
Join Date: Jul 2004
Posts: 24
Thanks: 0
Thanked 0 Times in 0 Posts
Insert Record

i have a insert Record page, and an access database with an autonumber field (ProductID), is it possible to show the autoincremented ProductID in the insert record form? So that user knows wht's the ProductID for the record he is going to add?

Please help.

Thanksss.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!

  #2  
Old Aug 23rd, 2004, 19:10
Most Reputable Member
Join Date: Jul 2003
Posts: 1,856
Thanks: 0
Thanked 0 Times in 0 Posts
If there's only one user for the system you could, but otherwise it's not possible. For example 3 different people could add a record between you starting to fill out your form and finishing it, and that would change the next ID used.

That said, there is a way around it. You could add a blank entry to the database when the user starts the form, then report back the ID that was created, then use the ID to update the record when the user is done. You'd need to deal with people cancelling their add though, and the blank record that would be left from it - which is possible, just not simple.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
  #3  
Old Aug 23rd, 2004, 21:47
Reputable Member
Join Date: Aug 2003
Location: United Kingdom
Posts: 341
Thanks: 0
Thanked 0 Times in 0 Posts
I've always used @@Identity (SQL) for this in the past, but I've never been able to do this in Access, despite the fact that the MS documentation says it's possible...
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
  #4  
Old Aug 24th, 2004, 08:10
Highly Reputable Member
Join Date: Jul 2003
Location: Ipswich, UK
Posts: 690
Thanks: 0
Thanked 0 Times in 0 Posts
The Jet OLEDB Provider supports @@Identity, check it out:
http://adopenstatic.com/experiments/...autonumber.asp
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
  #5  
Old Aug 24th, 2004, 09:33
Most Reputable Member
Join Date: Jul 2003
Posts: 1,856
Thanks: 0
Thanked 0 Times in 0 Posts
Yeah, but red wants the identity prior to adding the record...
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
  #6  
Old Aug 24th, 2004, 09:44
Rob's Avatar
Rob Rob is offline
Webforumz Founder
Join Date: Jul 2003
Location: Southern UK
Age: 34
Posts: 3,159
Blog Entries: 7
Thanks: 27
Thanked 19 Times in 16 Posts
This will involve creating a blank record.... then grabbing the id number. When the record is finally inserted, it will UPDATE the blank record.

Any other method will involve locking, and keeping the lock on until the record is finally added..... as this is dependant on user input, the lock could be on a fair while.

I really dont see though, why the user would need to see the record number? If they do, then cant you just reveal it to them after they have added the record?
__________________
Click the 'Thanks!' button if this post has helped you

Rob - Webforumz Founder
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
  #7  
Old Aug 24th, 2004, 09:49
Highly Reputable Member
Join Date: Jul 2003
Location: Ipswich, UK
Posts: 690
Thanks: 0
Thanked 0 Times in 0 Posts
what about selecting the last record id and adding 1 to it?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
  #8  
Old Aug 24th, 2004, 22:08
Most Reputable Member
Join Date: Jul 2003
Posts: 1,856
Thanks: 0
Thanked 0 Times in 0 Posts
That would only work on a 1 user system smokie.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
  #9  
Old Aug 25th, 2004, 08:45
Highly Reputable Member
Join Date: Jul 2003
Location: Ipswich, UK
Posts: 690
Thanks: 0
Thanked 0 Times in 0 Posts
As yes, I should have read your first reply!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
  #10  
Old Aug 25th, 2004, 11:45
New Member
Join Date: Aug 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
<blockquote id="quote" class="ffs">quote:<hr height="1" noshade="noshade" id="quote" />Originally posted by redkyna
i have a insert Record page, and an access database with an autonumber field (ProductID), is it possible to show the autoincremented ProductID in the insert record form? So that user knows wht's the ProductID for the record he is going to add?

Please help.

Thanksss.

<hr height="1" noshade="noshade" id="quote" /></blockquote id="quote">
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
  #11  
Old Aug 25th, 2004, 15:50
Junior Member
Join Date: Jul 2004
Posts: 24
Thanks: 0
Thanked 0 Times in 0 Posts
thanks guys, i have put it this way, not using the autonumber anymore but set it to no-duplicates. Get the max(id) then plus one. The system will only be used for 2 or 3 ppl so i guess this will work just fine.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
  #12  
Old Aug 25th, 2004, 22:46
Most Reputable Member
Join Date: Jul 2003
Posts: 1,856
Thanks: 0
Thanked 0 Times in 0 Posts
The no-duplicates will just give you an error when you try to add using your guessed new id if someone else uses that id first, so I don't know that it'll be a good solution for this.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Closed Thread

Tags
insert, record

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
SQL Insert help air duster Classic ASP 13 Jan 12th, 2006 08:38
Insert record in mysql djme Databases 1 Dec 24th, 2005 01:42
insert record accessman Databases 1 Oct 15th, 2005 01:12
how to quickly insert a record gab Classic ASP 5 Oct 31st, 2003 18:28


All times are GMT. The time now is 03:43.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42