Unique Identifier needed!

Results 1 to 7 of 7

Thread: Unique Identifier needed!

  1. #1
    Rob V Guest

    Default Unique Identifier needed!

    Good afternoon folks, <BR><BR>I am writing a classified ad page using ASP on Visual Interdev 6.0 which is viewable at: http://h004f49086f4a.ne.mediaone.net/oldsads/placead.asp <BR><BR>You can see the actual source by going to: http://h004f49086f4a.ne.mediaone.net/oldsads/placead.txt <BR>and viewing source.<BR><BR>The placead.asp page sends the submitted data to the insertad.asp page and the source to that page can be seen by viewing source at this link:<BR>http://h004f49086f4a.ne.mediaone.net/oldsads/insertad.txt<BR><BR>Currently ads can be submitted to the database. But I am trying to figure out a way to assign each ad a unique identifier. This is probably something very easy but I cannot figure out how to accomplish it. The unique identifier should be an auto-calculated field on the last cell of the page, and when the user clicks submit the unique ID would get submitted into the database. Right now I just have the date put in the cell and it is an editable field, and the value does get into the DB fine, though not unique and not auto-calculated or uneditable (can fix the last one easily). <BR><BR>I thought I would try to create my own UID by using the date with no &#039/&#039 characters in it and add a number to the end - 0, 1, 2 etc (incrementing each ad like a hit counter). Or to use the date and time and remove all &#039/ &#039 AM PM and space&#039 characters (year&#124month&#124day&#124hour&#124min&#124sec). <BR><BR>I figure there must be a better way and all my attempts thus far have failed. <BR><BR>I also tried creating a dll VB6 component file as described in http://www.aspzone.com/articles/john/GUIDGen/BuildaGUIDGeneratingComponent.asp but when I tried to import the generated dll file into Visual Interdev the component was not listed in the list, probably it needs some sort of a name to reference it. Other dlls get added fine to VI so I am not sure what the problem is there. <BR><BR>Any suggestions? Is there an easy way or better way to do what I am trying to accomplish?<BR>Thanks in advance!<BR>Rob

  2. #2
    Steve Cimino Guest

    Default RE: Unique Identifier needed!

    If you&#039re not using a GUID, another way is to get the number of milliseconds since midnight, January 1, 1970. This is a built in function for Java/JavaScript, so you may need to do a bit of language switching.

  3. #3
    Rob V Guest

    Default RE: Unique Identifier needed!

    Steve,<BR><BR>Facinating idea, I will start looking for the script at the <BR>popular script hangouts. I would like to use a GUID, just not sure how!<BR><BR>Still open to other options anyone?<BR><BR>Thanks!<BR>Rob

  4. #4
    Steve Cimino Guest

    Default RE: Unique Identifier needed!

    If you&#039re using SQL Server, you can default to a UUID. What database are you using?

  5. #5
    Rob V Guest

    Default RE: Unique Identifier needed!

    Sorry, forgot to mention that the DB is SQL 7.0. Not sure how to use a default UUID. My DB has 1 table. I tried to ad a colum in Enterprise manager with a column name of AdID and type of uniqueidentifier but I had problems:<BR>1) If the asp page had a field for the AdID, it would show the ID value.<BR>2) If the asp page did not have field for the ID, their were problems submitting the data to the SQL DB table. It would be cool if the placead.asp page did not have the Ad ID field and then I could display this field after the ad was submitted. But I could not get the data submitted in this fashion. Therefore I figured if I could get the ASP page to "come up" with a UID, it would go into the field as the default value, make the field read-only, and off it goes into the DB!<BR><BR>Rob

  6. #6
    Rob Guest

    Default RE: Unique Identifier needed - correction to above

    Sorry for unclarity - <BR>1) If I had an AdID field in the ASP form, it would be blank on the page so it showed NO value. As seen in #2 mentioned above, I designed the DB with an AdID column but it did not assign a value automatically, and gave ASP errors on submit.<BR>Thanks!<BR>Rob

  7. #7
    Chuck Berry Guest

    Default RE: Unique Identifier needed - correction to above

    One way to do this would be to create a stored procedure in SQL and use a Select statement to return the value. I have some code around here if you want it. Do you know how to do this in Access? I have an table that I assigned a UID (autonumber) table to - As I add the record to the table, I don&#039t have to worry about the UID, it&#039s already assigned automatically to Access. Unfortunately, for one page that I&#039m working on, I need it so I can hyperlink with the UID to another page to add a row to a child table with the UID referenced in the row. I don&#039t think autonumber is going to work in this situation as well. What are your thoughts?

Posting Permissions

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