SELECT @@IDENTITY question

How do i use the SELECT @@IDENTITY with the code below?
Andy
<%
'declare your variables
Dim firstname, lastname, company
Dim sConnString, connection, sSQL
'Receiving values from Form, assign the values entered to
variables
firstname = Request("first_name")
lastname= Request("last_name")
company =Request("company")
'declare SQL statement that will query the database
sSQL = "INSERT into customers (firstname, lastname,
companyname) values ('"
& firstname & "', '" & lastname & "', '"
& company & "')"
'define the connection string, specify database
'driver and the location of database
sConnString="Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=D:\WebSite_folders\mysite\mydb.mdb; "
'create an ADO connection object
Set connection = Server.CreateObject("ADODB.Connection")
'Open the connection to the database
connection.Open(sConnString)
'execute the SQL
connection.execute(sSQL)
response.write "The form information was inserted
successfully."
'Done. Close the connection object
connection.Close
Set connection = Nothing
%>

Have a look at the SCOPE_IDENTITY() function as opposed to
@@IDENTITY. I
always prefer to use this method.
Pat.
"Andy" <[email protected]> wrote in
message
news:[email protected]...
> Its ok i sorted it out.
> I was being a bit DIM
>
> :-)
>
> Andy
>
>
>
> "Andy" <[email protected]> wrote
in message
> news:[email protected]...
>> I'm using this now but getting another error
>>
>>
>> Error Type:
>> Microsoft VBScript runtime (0x800A01F4)
>> Variable is undefined: 'commInsert'
>>
>>
>> <% Option Explicit %>
>> <%
>> Dim firstname, lastname, company
>> 'Receiving values from Form, assign the values
entered to variables
>> firstname = Request("first_name")
>> lastname = Request("last_name")
>> company = Request("company")
>> %>
>> <%
>> Set commInsert =
Server.CreateObject("ADODB.Connection")
>> commInsert.Open
"Provider=Microsoft.Jet.OLEDB.4.0;Data
>> Source=D:\WebSite_folders\mysite\mydb.mdb; " '
Replace with your OLE DB
>> connection string.
>> commInsert.Execute "INSERT INTO
customers(firstname,lastname,companyname)
>> values ('" & firstname & "', '" &
lastname & "', '" & company & "')" '
>> Execute the insert command
>> Set rsNewID = commInsert.Execute("SELECT
@@IDENTITY") ' Create a
>> recordset
>> and SELECT the new Identity
>> intNewID = rsNewID(0) ' Store the value of the new
identity in variable
>> intNewID
>> rsNewID.Close
>> Set rsNewID = Nothing
>> commInsert.Close
>> Set commInsert = Nothing
>> %>
>>
>>
>> "Andy" <[email protected]>
wrote in message
>> news:[email protected]...
>> > How do i use the SELECT @@IDENTITY with the
code below?
>> >
>> > Andy
>> >
>> >
>> > <%
>> > 'declare your variables
>> > Dim firstname, lastname, company
>> > Dim sConnString, connection, sSQL
>> > 'Receiving values from Form, assign the values
entered to variables
>> > firstname = Request("first_name")
>> > lastname= Request("last_name")
>> > company =Request("company")
>> >
>> > 'declare SQL statement that will query the
database
>> > sSQL = "INSERT into customers (firstname,
lastname, companyname) values
>> ('"
>> > & firstname & "', '" & lastname
& "', '" & company & "')"
>> >
>> > 'define the connection string, specify database
>> > 'driver and the location of database
>> >
sConnString="Provider=Microsoft.Jet.OLEDB.4.0;Data
>> > Source=D:\WebSite_folders\mysite\mydb.mdb; "
>> > 'create an ADO connection object
>> > Set connection =
Server.CreateObject("ADODB.Connection")
>> >
>> > 'Open the connection to the database
>> > connection.Open(sConnString)
>> >
>> > 'execute the SQL
>> > connection.execute(sSQL)
>> >
>> >
>> >
>> > response.write "The form information was
inserted successfully."
>> > 'Done. Close the connection object
>> > connection.Close
>> > Set connection = Nothing
>> > %>
>> >
>> >
>>
>>
>
>

Similar Messages

  • I forget my identity question and I wrote wrong email address for rescue email

    I forget my identity question and I wrote wrong email address for rescue email so I've tried to contact. Apple support about 2 days and I failed.
    what should I do          

    How did you try to contact Support ? You should be able to contact Support in your country, who should be able to reset your questions, via the link/number for your country on this page : http://support.apple.com/kb/HT5699
    When they've been reset you can then use the steps on this page to update your rescue email address for potential future use : http://support.apple.com/kb/HT5620

  • Trouble selecting security questions for iOS app store

    We bought my daughter an iPad mini for Christmas, and until today, were able to happily download apps from the iOS app store. But this morning, it prompted me to select three security questions before allowing a download. Which is fine, but it wouldn't provide any security questions to choose from. Steps to reproduce error:
    Select an app to download/install
    Receive prompt to select three security questions
    Click OK
    Receive prompt to enter apple ID password
    Enter password
    Receive dialog box requesting to select three security questions/answers, plus a rescue e-mail address
    Click area to select first question
    Receive a blank white box, which never fills in with anything
    I'm baffled: nothing ever shows up in the box described in step 8), so I can never select a security question, so I can't continue the process of downloading apps. I've tried this several times over the course of the day today, and I'm getting nowhere. Any thoughts?

    Ok, problem solved. It turns out that rebooting the iPad caused this to start working correctly. So I recommend a restart if anyone has this problem.

  • HT5699 I don't know my answers to the identity questions, can you help me?

    I don't know any of my answers to the identity questions, can you help me?

    Go back to the article you asked this question from and use one of the methods of contacting Apple. The people on these boards can't reset your security questions.
    (95441)

  • Basic Quick Selection Tool Question

    Is this just a newer way to do the same thing the other selections tools have been doing for years OR is there a benefit to this tool over the other selection tools?

    The Quick Selection Tool does indeed operate differently from the Magic Wand Tool.
    But it’s been introduced at least with CS3, so why the question now?

  • Scene Selection Menu Question

    I will try and make this question as unconfusing as possible. I have a DVD with a basic menu screen. It offers to play the whole film or go to the scene selection menu. When I go to the scene selection menu obviously I have the option to do just that. When I select a scene (or chapter) it will play it. My question is, if I have picked the wrong scene or I just want to go back to the scene selection menu, how do I make that happen? If I press menu it will just take me back to the main menu. It seems tedious to do it that way to keep having to go back to the main menu then to the scene selections menu. In short
    What do I need to do to make the dvd go back to the scene selections menu when it was the last one selected?

    What do I need to do to make the dvd go back to the scene selections menu when it was the last one selected?
    You can also program the remote control's functions specifically for your DVD. It's not easy to understand in the manual but it's all explained. For instance, you could program the TITLE or MENU keys to return specifically to the scene selection menu. The problem with changing the programming is that's how the key will work for your entire disk unless, of course, you can figure out how to use the user memory registers and write a little script that will have conditionals.
    bogiesan

  • Select color question.

    Hello everyone, I am a new member. My question is, is it possible to create an action in the action palette which chooses a specific color I want , instead of doing it manually with the magic wand?
    For example something like "Set selection all blacks"?
    Thank you in advance for your answers.

    It might be possible to automate some color selections using Select>Color Range.

  • Simple Selection-screen question

    Right now my selection screen shows the variable names that I have assigned.  The variable name is limited to 8 chars. I would like to be able to set the text.  I know this is a very easy question and Im sorry to waste a forum post on it!
    Here's what I got:
    SELECTION-SCREEN BEGIN OF BLOCK BL1 WITH FRAME TITLE TEXT-100.
    SELECT-OPTIONS: network  FOR AFPO-AUFNR.
    SELECT-OPTIONS: s_dauat  FOR AFPO-DAUAT.
    SELECT-OPTIONS: fnsh_dat FOR AFKO-GSTRS.
    SELECT-OPTIONS: strt_dat FOR AFKO-GLTRS.
    SELECT-OPTIONS: status   FOR TJ02T-TXT30.
    SELECTION-SCREEN END OF BLOCK BL1.

    2 ways,
    1) Go to TextElements and selection text and give the description there.
    2) Using SELECTION-SCREEN COMMENT
    For example
    SELECTION-SCREEN BEGIN OF BLOCK BL1 WITH FRAME TITLE TEXT-100.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 3(20) TEXT-001 FOR FIELD network.
    selection-screen position 45.
    SELECT-OPTIONS: network FOR AFPO-AUFNR.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN END OF BLOCK BL1.
    Here you may need to double click on TEXT-001 and give the description.
    rgds,
    TM.

  • KEEP IDENTITY questions

    Hi there,
    I'm trying to figure out something about rolling upgrades with a transient logical standby that seems to escape me.
    So, one of the first steps is to convert the standby database to a logical standby (with KEEP IDENTITY clause), startup for upgrade, and then run the catupgrd script. During this time the standby is not applying redo from the primary.
    I understand that the KEEP IDENTITY clause causes the logical standby to retain the same DBID and name as the primary database.
    Questions:
    1. Why is KEEP IDENTITY required? For example, what would happen if the KEEP IDENTITY clause was not used during the upgrade, and the standby retained it's own identity?
    2. Is KEEP IDENTITY a specific requirement for the upgrade process, or can this clause be used for other uses?
    3. This question is not specifically related to "KEEP IDENTITY". So, how is it possible that you can run catupgrd to upgrade the standby database and THEN begin to receive redo from the primary? I know in a physical standby, the system would balk because of different system SCNs after the catupgrd prevent it from doing managed recovery. So does a logical standby ignore SCNs? (Sorry, I know physical standbys well, but not enough about logical standbys to answer this question myself)
    Any answers would be appreciated...
    Thanks.
    Rob

    Questions:
    1. Why is KEEP IDENTITY required? For example, what would happen if the KEEP IDENTITY clause was not used during the upgrade, and the standby retained it's own identity?
    2. Is KEEP IDENTITY a specific requirement for the upgrade process, or can this clause be used for other uses?
    3. This question is not specifically related to "KEEP IDENTITY". So, how is it possible that you can run catupgrd to upgrade the standby database and THEN begin to receive redo from the primary? I know in a physical standby, the system would balk because of different system SCNs after the catupgrd prevent it from doing managed recovery. So does a logical standby ignore SCNs? (Sorry, I know physical standbys well, but not enough about logical standbys to answer this question myself)What is your version?
    For db_name, specify a database name to identify the new logical standby database. If you are using a server parameter file (spfile) at the time you issue this statement, then the database will update the file with appropriate information about the new logical standby database. If you are not using an spfile, then the database issues a message reminding you to set the name of the DB_NAME parameter after shutting down the database.
    a rolling upgrade from Oracle 11g Release 1 to Oracle 11g Release 2 using a Transient Logical Standby database. This approach will miminise the downtime required for an upgrade which can potentially run into several hours down to just the time required to perform a switchover which could be a few minutes in most cases.
    A rolling upgrade using a Transient Logical Standby database at a very high level will involve three main stages or steps:
    1) Temporarily convert a physical standby database to a logical standby database using the new KEEP IDENTITY clause
    2) Perform a database upgrade of the logical standby database
    3) Return the logical standby database back to its identity or original status as a physical standby database once the upgrade is completeHere some great links
    http://gavinsoorma.com/tag/keep-identity/
    http://docs.oracle.com/cd/B28359_01/server.111/b28294/create_ls.htm

  • Selection tools question

    I'm fairly new to Photoshop Elements, so hope fully this is a simple question.
    I've used the selction tools, magic wand, lassos, etc, to trace out areas of a photo that I want to eliminate and fill with another layer.  I only have my background layer, a color fill layer, and a gradient layer.  Problem is, when I go back to my background layer, my selections that I traced out are no longer accessible, and it seems like I have to redo all my selctions again.  There's got to be a way to keep and access my selections, but I'm unsure how to do this.  Any suggestions?  Thanks!
    Nate

    nateu,
    Have a look at this print screen of a selection of the swan and the layer structure:
    http://www.pixentral.com/show.php?picture=1usGtChF3D8cfv7mPcaCKt7Lw9IsG1
    I duplicated the background layer, then shut off the visibility of the background layer by clicking on its eye icon, worked on the background copy layer. I do this routinely, since the background layer is a locked layer, and also if I wish to start over again, I just delete the newly generated layers and am back to square one. The academic purists may not agree with this work-flow, but so be it.
    Next, I selected the swan - used the magnetic lasso tool here, but any of the selection tools will work. You should see "marching ants" around the selection, indicating that it is active.
    Then, I went to Layer>new>layer via copy. This put the swan on its own layer. Note the checkerboard pattern around the swan selection - indicating transparency
    You can put a blank layer between the swan layer (Layer 1) and the background copy layer, fill it with color, or a gradient, or texture, etc. for a new background
    If you want to save the selection as per Ken's post, Press CTRL+left click the swan thumbnail on Layer 1 to make it active, then go to Select>save selection

  • Agent Selection/Routing Question

    Hello:
    I wanted to run a question by the group to get some feedback on a question I have surrounding Agent routing within UCCX (8.5 su4).
    Here is the setup of the environment:
    CSQ1: General
    Routing Criteria: LAA
    CSQ2: Spanish
    Routing Criteria: Most Skilled
    Agent1
    has Skills of General and Spanish. 
    Their competency is the same within both skills.
    Question: Calls are in queue for both CSQ's, although the call in the spanish CSQ has been in queue longer.  And agent 1 goes ready.  Whats currently happening is that agent 1 is getting another call from the General Queue as opposed to getting it from the spanish queue.
    How do I ensure that agent 1 gets the call from the spanish CSQ over the general CSQ?  Each CSQ needs to keep the Routing Criteria the same.
    My thought is that it has to be one of these two items, if not a combination of both.
    Decrease the Competency of all General agents to a (5) and Making the Spanish competency higher then 5.
    in the script, for Spanish Calls use the Set Priority Node to increase Spanish queued calls to be at like a 5, to ensure all spanish calls have a higher priority then general Calls.
    Any feedback would be appreciated! 

    Hi Sean
    All calls on the system if you are not using priority steps already should be answered FIFO... provided that there are agents available in the queue that the first call came in (i.e. they meet the minimum competency). Competency, skills/LAA and all those algorythms only affect who gets the call, not which one is served first. The exception to that is if the competency excludes some agents from the CSQ completely.
    So a call that arrives in 'Spanish' first should be routed to agents first, as long as there are agents available. Does the same apply if the agent is 'ready' but on a call for example? E.g. call voicemail as the agent, then put a call in to spanish, then one in general, and see which one comes through first.
    Priority will work, but will mean that Spanish calls alway queue jump. Priority is absolute, so a p2 call will jump in front of all other lower-priority calls regardless of how long they have been there.
    If you just want first-come-first-served, then that's what you should have by default.
    Aaron

  • Dynamic Select query question

    I have a select query which uses a session variable in the
    where clause like so:
    select employee_lastname
    from employee
    where employee_id IN (#session.ids#)
    This runs fine if I have only 1 employee id in session.ids,
    but if I have multiple (i.e. 22,26,49) it crashes. Do I need to do
    some sort of list or string conversion on my session variable?
    Thanks in advance!
    Dave

    I re-read my reply and it came off as if i didn't read your
    (op) last post, sorry about that. I attempted to recreate your
    effect (see code below) I did a 'quick' session on the output page;
    <cfquery datasource="#DSN#" name="test">
    select busName, ID
    from Hernandomembers
    </cfquery>
    <body>
    <form id="form1" name="form1" method="post"
    action="delme.cfm">
    <label>
    <select name="list" id="select" multiple="multiple">
    <cfoutput query="test">
    <option value="#ID#">#busName#</option>
    </cfoutput>
    </select>
    </label>
    <label>
    <input type="submit" name="button" id="button"
    value="Submit" />
    </label>
    </form>
    Collects the selections of members from my DB and sends it to
    a page with ....
    <cfset SESSION.employee_ids=StructNew()>
    <cfset SESSION.employee_ids="#form.list#">
    <cfoutput>#SESSION.employee_ids#<br />
    </cfoutput>
    <cfquery datasource="#DSN#" name="test">
    select busName,ID
    from Hernandomembers
    where ID IN(#SESSION.employee_ids#)
    </cfquery>
    <cfoutput query="test">
    #ID# - #busName#<br />
    </cfoutput>
    And it works just as yours should.. So i guess I'd still like
    to see how your getting the selections into the session, if not the
    same way as me.

  • JTree and selected node question

    Hello
    Is it possible to convert the selected node to an int?
    I guess I'm looking for something llike this.
    int nodeNumber = node.getSelectedIndex();
    There is nothing like that in the API, and it would help greatly if I could find a way do this.
    Thanks
    Have a good holiday
    Jim

    From the API for JTree
    public int getMinSelectionRow()
    Gets the first selected row.
    Returns:
    an integer designating the first selected row, where 0 is the first row in the display
    But I think this is based on how many rows are displayed at the present time and might change if the tree is opened above it.

  • Select expert question

    Hi,
      I just changed an existing report to have a filter on one of my groups.  I used the select expert and filtered using the "is not equal to" criteria.  Everything works as it should when I view the report in crystal, my filtered objects do not show up.  When I then open that same report in Cabinet vision (the program we use the reports inside) the filter does not work.  I know that this could be a problem with the cabinet program, but I figured I would check into there being anything I may have missed when using the select expert.
    Thanks for any ideas,
    Mike

    We use a .RIM file to get these reports working in cabinet vision, my problem was with the setup of this file.  More specifically I should have had the value for GSF_ForRecordSelection set to false, mine was -1.

  • Selection screen question

    Hello !
    I  have a report that generates system messages.
    I have to copy the code from a system to another, with all objects beloging to report.
    These objects are: dictonary structures, fields, soubroutines and a selection screen.
    After the copy and activation of the report, I see all objects in the new system, except the selection screen.
    I guess that is because I did not run the report yet in the new system, but I' m not sure.
    Running will involve some extra messages, so I thought I better ask for certain first.
    Thank you.
    Edited by: AV on Sep 11, 2008 9:11 AM

    No.
    So...I had a report in  system1.
    Copied the code to system 2.
    The reports runs the same manner for both systems.
    The reports includes a PARAMETERS instruction and when I run it in the system2, I can see there:
    System-> Status -> Screen number 1000.
    I don't understand why in system1 , I have for the report ( in SE80) as an object beloging to report:
    Programs-> zxxxx Report-> Screen -> Screen 1000
    and in system2 (in SE80) , the same report has no Screen attached (in hierarchy).
    As if I copied the code, run it, but Screen object does not appear anymore in report hierarchy.
    Any clue?
    Edited by: Anda Vicovan on Sep 11, 2008 10:21 AM

Maybe you are looking for