Help with -- SELECT @@Identity

Results 1 to 2 of 2

Thread: Help with -- SELECT @@Identity

  1. #1
    Join Date
    Dec 1969

    Default Help with -- SELECT @@Identity

    To all experts out there...<BR>I am trying to get the Autonumber (SerialNumber) from MS Access 97 table "Trans" after an Insert statement using "SELECT @@Identity" . But all I get was "0". Have been trying to see where gone wrong but with my limited knowledge, cannot find out why. <BR><BR>Any help will be most appreciated.<BR>Thanks in advance....<BR><BR>Wilson.<BR><BR>--------------------------------------------------<BR>Set Conn=Server.CreateObject("ADODB.Connection")<BR>se t objRec =Server.CreateObject("ADODB.Recordset")<BR>Conn.Op en myDSN<BR><BR>for j=1 to 28<BR> x=request("YES" & j & "")<BR> if x &#060;&#062; "" then<BR> bookTime=x<BR> mySQL="Insert into trans (UserID, BookDate, BookTime, EquipmentID) values (&#039;"& sBookUserID & "&#039;,&#039;" & sBookDate & "&#039;,&#039;" & bookTime & "&#039;,&#039;" & sEQPTID &"&#039;)"<BR> set objRec = Conn.Execute(mySQL)<BR>&#039;------ <BR> strSQL = "SELECT @@Identity"<BR> set objRec = Conn.Execute(strSQL)<BR> Serial = objRec.Fields.Item(0).value<BR>&#039;------<BR>end if<BR>next<BR>Conn.close

  2. #2
    Join Date
    Dec 1969

    Default RE: Help with -- SELECT @@Identity

    Hmm.. yes. @@identity is picky in Access/ASP<BR><BR>see here for the method I use :<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