Auto generation of Unique ID

Results 1 to 2 of 2

Thread: Auto generation of Unique ID

  1. #1
    Join Date
    Dec 1969

    Default Auto generation of Unique ID

    &nbsp;<BR>Hi , <BR>i have a form with three input fields.<BR>i am posting that form to my asp page to insert data in the database.<BR><BR>name=Request.Form("name")<BR>city =Request.Form("name")<BR>address=Request.Form("nam e")<BR><BR><BR>i want to create a unique ID automatically against these three records.<BR>i have four fields in my table <BR>name (text)<BR>city (text)<BR>address (text)<BR>ID ( autonumber + primary key)<BR><BR>i dont how to write a query for insertion of these three input fields which automatically creates the unique ID in the table.<BR><BR>i am using this code<BR><BR>&#060;%<BR>Set Conn = Server.CreateObject("ADODB.Connection")<BR>sConn = "Provider=Microsoft.Jet.OLEDB.4.0;" & _<BR> "Data Source=" & Server.MapPath("data.mdb") & ";" & _<BR> "Persist Security Info=False"<BR>Conn.Open(sConn)<BR><BR>q= "Insert into info Values(&#039;"&name&"&#039;,&#039;"&city&"&#039;,& #039;"&address&"&#039;)<BR>conn.Execute(q)<BR><BR> <BR>conn.Close<BR>Set conn = Nothing<BR>%&#062;<BR><BR>please do guide me , that what i have to do ?<BR>thanx<BR><BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: Auto generation of Unique ID

    q= "Insert into info (name of the name column,name of the city column,name of the address column) Values(&#039;"&name&"&#039;,&#039;"&city&"&#039;,& #039;"&address&"&#039;)<BR><BR>Also you have to add and identity seed to your id column to generate automatic IDs, if you use SQL server, but in Access choose an autonumber when you create the coulmn<BR>

Posting Permissions

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