Insert Record / Retrieve Uunique ID from SQL Serve

Results 1 to 2 of 2

Thread: Insert Record / Retrieve Uunique ID from SQL Serve

  1. #1
    Join Date
    Dec 1969

    Default Insert Record / Retrieve Uunique ID from SQL Serve

    YOUR RESPONSE:<BR><BR> <BR>Insert record / Retrieve unique id from SQL Server<BR> <BR>jmdennis999 - 26 Oct - 03:29:32 PM<BR>--------------------------------------------------------------------------------<BR>Hi all. I am using one of the 4Guys articles on how to insert a record into SQL Server and retrieve its unique id. Here is the link to the article:<BR><BR><BR>I&#039;m trying to test the script, but I am getting multiple errors on my field values. Can you tell me how to enter these values correctly? I need to enter dates, variables, and server variables for my values and they are all returning errors.<BR><BR>Here are the errors i&#039;m getting:<BR>Invalid object name &#039;Request.ServerVariables&#039;<BR>The name &#039;now&#039; is not permitted in this context<BR>&#039;Date&#039; is not a recognized function name<BR><BR>Here is the script I am using:<BR><BR>Set objRSsql = objConnSTATS.execute("INSERT INTO tblUserDetails (fConnections, fIPAddress, fDailyVisits, fMonth, fYear, fDateVisited) " & _<BR>"VALUES (Request.ServerVariables(&#039;HTTP_CONNECTION&#03 9;), Request.ServerVariables(&#039;REMOTE_ADDR&#039;), 1, strMonthName, Year(now), Date());" & _<BR>"SELECT @@identity").nextrecordset<BR><BR>&#039;Retrieve the @@IDENTITY value<BR>strNewID = objRSsql(0)<BR><BR>thanks,<BR>dennis

  2. #2
    Join Date
    Dec 1969

    Default Nope...Here is the most efficient way...

    ...along with the one that will cause you the least amount of problems with special characters.<BR><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