Grabbing a field that I just entered

Results 1 to 2 of 2

Thread: Grabbing a field that I just entered

  1. #1
    Join Date
    Dec 1969

    Default Grabbing a field that I just entered

    I read the example on the page for access (I am using SQL7.0) and figured it would work but it doens&#039t seem to be working. I am adding a user and right after I add them I would like to write a cookie with there info, thus I need to grab the unique id. The code is below but what it just enters nothing in the spot for the artistID and the userlevel in the cookie.<BR><BR>Set objRS = Server.CreateObject("ADODB.Recordset")<BR> SQLcheck = "SELECT * FROM tblArtists"<BR> objRS.Open SQLcheck, objConn,3,3<BR><BR> objRS.AddNew<BR> objRS("artistName") = addArtistName<BR> objRS("email") = addEmail<BR> objRS("password") = addPassword<BR> objRS("artistIP") = Request.ServerVariables("REMOTE_ADDR")<BR> objRS.Update<BR><BR> newArtistID = objRS("artistID")<BR> newUserLevel = objRS("userlevel")<BR><BR> Response.Cookies("dnb")("artistID") = newArtistID<BR> Response.Cookies("dnb")("artistName") = addArtistName<BR> Response.Cookies("dnb")("userLevel") = newUserLevel<BR> Response.Cookies("dnb")("email") = addEmail<BR> Response.Cookies("dnb")("lastVisit") = now<BR> Response.Cookies("dnb").expires = Date +2<BR> <BR> Response.Redirect ""<BR> Response.End<BR> <BR> objRS.Close<BR> Set objRS = Nothing<BR> objConn.Close<BR> Set objConn = Nothing

  2. #2
    Join Date
    Dec 1969

    Default SQL Server is different...

    Look here and on for articles on this topic.<BR><BR>Also, this exact same question was answered on Friday, either in this forum or in the Database forum. I posted an answer that said I didn&#039t know, so if you look for posts by me--and one where the subject ends with "Help!"--I think you&#039ll find the thread and a couple of answers. NOTE: The earlier one from 4Guys has a fatal flaw! It doesn&#039t protect against simultaneous updates. That can be fixed, but the other scheme is more elegant.<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