Results 1 to 4 of 4

Thread: Returning the DB Key immediately after Add in EP

  1. #1
    lennart Guest

    Returning the DB Key immediately after Add in EP

    This item has appeared before "Returning the DB Key immediately after Add in EP", but back then no answers/solution was found. Is there someone who knows how to get the record ID for an entry made in a table right after you have added this record.

    would really help me

    Thanks,

    Lennart

  2. #2
    Mark Guest

    Returning the DB Key immediately after Add in EP (reply)

    Lennart,

    Is this SQL Server? If so, use the new @@keyword feature. It's very new and we don't have any examples yet, but I'll try to find some doc on it. Try USIntertech's site. It should be doc'd there.

    Mark.

    ------------
    lennart at 2/15/01 7:39:27 PM

    This item has appeared before "Returning the DB Key immediately after Add in EP", but back then no answers/solution was found. Is there someone who knows how to get the record ID for an entry made in a table right after you have added this record.

    would really help me

    Thanks,

    Lennart

  3. #3
    Frank Kwong Guest

    Returning the DB Key immediately after Add in EP (reply)

    Try the following ->

    10.23.00
    * Support SELECT Edit@@??? after MS-SQL edit action. dbEditParams="Edit@@=action_key_word|Variable_ Name|Repeat..."
    User specify the variable name(s) and SELECT @@keyword as 'xxx' will be executed after the edit action
    (like INSERT / UPDATE) and a session variable of the user specified name plus the dbUnit will be retuned.
    User is responsible whether this action retrival is appropriate by specifying this option. To retrieve the variable, use
    session(aspdb_variable_name_sx). If variable name is blank then it is the same as the keyword like session("aspdb_IDENTITY_999&#34.

    <%
    Set x = server.CreateObject(&#34;ASP.DB&#34
    x.dbUnit = &#34;999&#34;
    x.dbMode = &#34;Grid&#34;
    x.dbDBType = &#34;MSSQL&#34;
    x.dbDSN = &#34;Driver={SQL Server}; Database=pubs; UID=sa; Server=dell7500&#34;
    x.dbEditAddROFlds = &#34;job_id&#34;
    x.dbEditFlds = &#34;(;,[]|)job_desc, min_lvl, max_lvl&#34;
    x.dbEditParams = &#34;(;,)TableName=jobs, BookMarkFlds=job_id, Edit@@=identity|AddID&#34;
    x.dbEditUpdateROFlds = &#34;job_id&#34;
    x.dbEditAddROFlds = &#34;job_id&#34;
    x.dbNavigationItem = &#34;Top,Prev,Next,Bottom,GridRow,Reload,Edit,Upda te,Delete,Add&#34;
    x.dbSQL = &#34;SELECT job_id,job_desc,min_lvl,max_lvl FROM jobs&#34;
    x.aspdb
    Response.Write (&#34;IDENTITY=&#34; & Session(&#34;aspDB_AddID_999&#34)
    %>



    ------------
    Mark at 2/15/01 9:43:14 PM

    Lennart,

    Is this SQL Server? If so, use the new @@keyword feature. It&#39;s very new and we don&#39;t have any examples yet, but I&#39;ll try to find some doc on it. Try USIntertech&#39;s site. It should be doc&#39;d there.

    Mark.

    ------------
    lennart at 2/15/01 7:39:27 PM

    This item has appeared before &#34;Returning the DB Key immediately after Add in EP&#34;, but back then no answers/solution was found. Is there someone who knows how to get the record ID for an entry made in a table right after you have added this record.

    would really help me

    Thanks,

    Lennart

  4. #4
    Mark Guest

    Returning the DB Key immediately after Add in EP (reply)

    Lennart,

    If you want to see how to determine the ID of a newly added record, see Miscellaneous Example 8 at:
    http://www.aspdb.com/UNO

    Mark.


    ------------
    Frank Kwong at 2/16/01 1:37:22 AM

    Try the following ->

    10.23.00
    * Support SELECT Edit@@??? after MS-SQL edit action. dbEditParams=&#34;Edit@@=action_key_word|Variable_ Name|Repeat...&#34;
    User specify the variable name(s) and SELECT @@keyword as &#39;xxx&#39; will be executed after the edit action
    (like INSERT / UPDATE) and a session variable of the user specified name plus the dbUnit will be retuned.
    User is responsible whether this action retrival is appropriate by specifying this option. To retrieve the variable, use
    session(aspdb_variable_name_sx). If variable name is blank then it is the same as the keyword like session(&#34;aspdb_IDENTITY_999&#34.

    <%
    Set x = server.CreateObject(&#34;ASP.DB&#34
    x.dbUnit = &#34;999&#34;
    x.dbMode = &#34;Grid&#34;
    x.dbDBType = &#34;MSSQL&#34;
    x.dbDSN = &#34;Driver={SQL Server}; Database=pubs; UID=sa; Server=dell7500&#34;
    x.dbEditAddROFlds = &#34;job_id&#34;
    x.dbEditFlds = &#34;(;,[]|)job_desc, min_lvl, max_lvl&#34;
    x.dbEditParams = &#34;(;,)TableName=jobs, BookMarkFlds=job_id, Edit@@=identity|AddID&#34;
    x.dbEditUpdateROFlds = &#34;job_id&#34;
    x.dbEditAddROFlds = &#34;job_id&#34;
    x.dbNavigationItem = &#34;Top,Prev,Next,Bottom,GridRow,Reload,Edit,Upda te,Delete,Add&#34;
    x.dbSQL = &#34;SELECT job_id,job_desc,min_lvl,max_lvl FROM jobs&#34;
    x.aspdb
    Response.Write (&#34;IDENTITY=&#34; & Session(&#34;aspDB_AddID_999&#34)
    %>



    ------------
    Mark at 2/15/01 9:43:14 PM

    Lennart,

    Is this SQL Server? If so, use the new @@keyword feature. It&#39;s very new and we don&#39;t have any examples yet, but I&#39;ll try to find some doc on it. Try USIntertech&#39;s site. It should be doc&#39;d there.

    Mark.

    ------------
    lennart at 2/15/01 7:39:27 PM

    This item has appeared before &#34;Returning the DB Key immediately after Add in EP&#34;, but back then no answers/solution was found. Is there someone who knows how to get the record ID for an entry made in a table right after you have added this record.

    would really help me

    Thanks,

    Lennart

Posting Permissions

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