Results 1 to 5 of 5
  1. #1
    Join Date
    Apr 2004
    Posts
    75

    Exclamation Unanswered: 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

  2. #2
    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.

  3. #3
    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?

  4. #4
    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

  5. #5
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •