If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > Hidden field in a form

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-26-05, 22:31
breeze76 breeze76 is offline
Registered User
 
Join Date: Apr 2004
Posts: 75
Exclamation Hidden field in a form

I need to be able to have a hidden field that genterates a unique identifier eveytime a user fills out the form. This identifer will be inserted into my DB along with the rest of the info from the form. Is there a way of doing this? I am using the auto-incrememt on a field in the DB but there is no way I can use it to do what I want. SO, if any one can help I would appreciate it very much..

Thanks
Reply With Quote
  #2 (permalink)  
Old 01-26-05, 23:42
DrewM DrewM is offline
Registered User
 
Join Date: Jan 2005
Posts: 36
Having the unique identifier created in sql after you submit the form is the way to go. The table index is perfect for that. Although you say you can't use it.

Is the reason why you cannot use the table index as the unique identifier because you need to know it before it is created? If so - you could add an entry - then use the MAX function to get the index id.

Maybe - post why you can't use the index and perhaps there is a way to use the index. Using the index will be certainly the best way to do it.
Reply With Quote
  #3 (permalink)  
Old 01-28-05, 21:16
gyuan gyuan is offline
Registered User
 
Join Date: Dec 2003
Posts: 454
I'm not very clear to your question. Usually, when you create a table you can have a primary key on a field which is unique. After you set number of the Identity Increment, the value will be increased by the number automatically when you insert a row of data. Can you tell us why you need a hidden field with unique value?
Reply With Quote
  #4 (permalink)  
Old 01-31-05, 01:55
Bullschmidt Bullschmidt is offline
Guru
 
Join Date: Jun 2003
Location: USA
Posts: 1,032
<<
I need to be able to have a hidden field that genterates a unique identifier eveytime a user fills out the form... I am using the auto-incrememt on a field in the DB but there is no way I can use it to do what I want.
>>

I agree with others that have answered that the apparant natural way to go would be to find or calculate what the new autonumber would be. But if that really can't be done as you state (for whatever unknown reason), then perhaps create something on the spot based on the current system date/time somehow...
__________________
J. Paul Schmidt, Freelance Web and Database Developer
www.Bullschmidt.com
Access Database Sample, Web Database Sample, ASP Design Tips
Reply With Quote
  #5 (permalink)  
Old 01-31-05, 13:25
White Knight White Knight is offline
Registered User
 
Join Date: Dec 2004
Location: York, PA
Posts: 95
The only thing I disagree with is using Max to get the id back-- not the best method

Try using @@identity

http://www.aspfaqs.com/aspfaqs/ShowFAQ.asp?FAQID=79
__________________
Sorry to be terse
some say it's a curse
I know it's worse
I'm just diverse
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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