Help with multiple recordsets and pulling an ID value (ASP)

I started this discussion when first developing my project and posted on the General Tab.  I have figured out that issue (trying to get my Insert to work in ASP) but now am having trouble retrieving an ID value.  It should be simple.  I want to insert a new record into a single table and want to create a unique ID field.  I am using SQL Server and tried the Identity setting but won't be able to have admin privileges which are required to set the ID.  So, I'd like to just take the ID value from the last record and just add '1' to it to get a new unique ID manually. My INSERT portion was working, so I just decided to query the records to retrieve the last CatalogID and add '1' to get my new ID.  But it's not working!  I tried opening both a command and a recordset, but get various errors on invalid command use. 
Any help would be great!  I'm new to all of this!
I've posted a code snippet of what I thought I should do:
<%LANGUAGE = “VBSCRIPT” CODEPAGE=”65001”%)
<!--#include file=”Connections/CapConnect.asp”” -->
<%
If (Cstr(Request(“MM_insert”)) = “form1”) Then
                Dim MM_editCmd
                Dim MM_Lookup
                Dim NextCatalogID
                Set MM_Lookup = Server.CreateObject (“ADOB.Recordset”)
                MM_Lookup.ActiveConnection = MM_CapConnect_STRING
                MM_Liikup.Source = “Select CatalogID From dbo.tblCatalogItems ORDERBY CatalogID Ascending”
                MMLookup.Open
                MM_Lookup.MoveLast
                NextCatalogID = MM_Lookup.Fields(“CatalogID”) + 1   'this is supposed to be my new ID value
                Set MM_Lookup = Nothing
                Set MM_editCmd = Server.CreateObject(“ADOB.Command”)
                MM_editCmd.ActiveConnection = MM_CapConnect_STRING
                MM_editcmd.CommandText = “INSET INTO dbo.tblCatalogItems (CatalogID, ModelName, Description, POCName, [POCPhone]) VALUES (NextCatalogID, ?,?,?,?)
                MM_editcmd.Prepared = True
                MM_edit.Parameters.Append MM_editcmd.CreateParameter(“param2”, 202, 1, 100, Request.Form(“modelname”) )
              MM_edit.Parameters.Append MM_editcmd.CreateParameter(“param3”, 202, 1, 300, Request.Form(“Description”) )
[Subject line edited by moderator to add server model]

Ok, you've got lots of problems. First, explain again why you are not able to modify the CatologID to be an identity column? What is the datatype of that column now?
Next, you are going about selecting your recordset incorrectly. If you are just looking for the last value inserted, there is no need to return all values to the recordset. Just select the max value:
MM_Liikup.Source = “Select MAX (CatalogID) From dbo.tblCatalogItems”
Next, you have a typo in your insert statement "“INSET INTO" should be "INSERT INTO"
Next, your CommandText is wrong. There is no ending quote, and NextCatalogID will be treated as a string literal, not a variable. Use a ? placeholder for it and use the CreateParameter method to populate it.
Next, your command text includes 4 placeholder, but you are only populating 2.
But even when you get this to work it will be problematic. What happens when 2 users execute this at the same time? They both read the same value for the max record and increment by one, but the first will succeed and the second will fail. That's why it is always better to use an auto increment (Identity) column.

Similar Messages

  • Need help with multiple devices and apple id

    Between my husband and myself, we have two Iphones, two Ipads, and one Imac.  I back all of them up on my Imac using ONE iTunes account....we prefer not use Icloud, and I think that helps keep the information on each device relatively separate from each other...no overlaps with contacts and calendars.  We have one APPLE id and password, that we use for Itunes and the App Store.   We just got the Iphone 6 for my husband, and it keeps asking him to enter his Icloud PW.(his recognized user name is his PRIMARY email address)...which presumably he does not have, nor does he need (or maybe he does I need some real guidance on that).  To keep this from making him crazy can I just delete his Icloud account, which again presumably, was created automatically with the new Iphone 6 set up??
    Similarly, I need to use FIND my Phone (etc), and HIS devices are not in MY listed devices....is this because he NEEDS his own APPLE ID, or is there a way to add his devices to my list of devices within the APP....I thought because we share the Itunes account they should all be in MY devices.
    Can someone help me make sense of this?
    THANKS!!

    Hello melissaben6250,
    Thank you for using Apple Support Communities. 
    I understand that you are not seeing your husbands new iPhone 6 in your Find My iPhone app. First, while you may "prefer not use iCloud", you are using it, at least in regards to Find My iPhone for your existing devices.
    Now, for your husband's phone and Find My iPhone. It sounds like during the setup of his phone, he logged in to his Apple ID and even possibly created another iCloud account. In order to see his phone on your existing Find My iPhone, it will have to log in to the iCloud account where the other devices are signed in. Take a look at this article on troubleshooting Find My iPhone, especially the first section on the device not appearing.
    iCloud: Troubleshooting Find My iPhone, iPad, iPod touch, or Mac - Apple Support
    Cheers,
    Jeff D. 

  • Help with Multiple libraries and one storage location for files

    I cannot get an answer to this question anywhere and was really hoping that The [H] would be able to help.
    Here is my current set up that allows my wife and I to have completely independent libraries and ratings, but use the same files:
    -Shared folder with MP3s on a network drive.
    -Two PCs, each with it's own Ipod associated to it with individual libraries but all pointing to the same network share for MP3 Files.
    -Each PC is using the SAME Itunes account for downloads.
    -Each account has it's own library folder also on a network share.
    Now to my question(s)/problem with downloaded content:
    (1) Is there any way to have a file that is downloaded from Itunes be automatically placed in a shared location accessible to both Libraries? (Say if I download the latest Jack Johnson album, can it automatically show up in my wife's library and vice versa?)
    (2) Is there any way to share the album artwork versus having two copies of everything(one for each library)?
    So my goal is to have two libraries with a central location for ALL files, including anything downloaded from Itunes by each individual user. Is this possible?

    Have your wife transfer all purchases from the iPad into iTunes, backup her iPad and then sync with iTunes. Everything ... All media and other content will be available in that iTunes library and she will have a current backup.
    Assuming that your son will still be sharing your wife's Apple ID (he is too young to have one of his own) .... When you set up his iPad, restore the iPad from your wife's backup and then select only the content that you want your son to have on his iPad in the iTunes library and then sync that iPad with iTunes.
    The game progress is stored in the backup and should transfer onto his device when you restore from your wife's backup. You can always delete any content (apps, movies, music) that you don't want your son to have on the iPad, if you missed it when you synced with iTunes after setting the device up for him.
    You can set your sync preferences - any way that you want to - for both devices and still use the same iTunes library for both iPads. So ... Yes you can sync any apps that you want to his iPad and any apps that your wife wants to her iPad. You just need to restore your son's iPad from your wife's backup in order to get his game progress onto his iPad.
    In case you need these....
    Transfer purchases.
    http://support.apple.com/kb/HT1848
    How to backup and restore from a backup
    http://support.apple.com/kb/HT1766
    Remember to have your wife backup her iPad just before you restore his iPad from the backup so that his most recent progress will be available in the backup.

  • Help with multiple devices and one ID

    I am sure this has been asked before but i apologize as I am new at all this.
    This is my issue...
    In April I bought my wife and iPad 2 signed up for an ID and started downloading apps..no problems at all so far.
    Within a month we had downloaded a bunch of apps for my 4 yr old.
    I bought another iPad 2 for my 4 yr old so he can use on his own. This is the issue, in my wives iPad we downloaded some paid apps and some free ones, some of them are games that have been advancing as he is playing them...my wife has also downloaded some paid games that she has been playing.
    So here is my dilema, can I sync my wifes iPad with iTunes and then move the apps that I want to my sons iPad?
    Also, will the move also include where he left off in the app...for example if this is like a building a zoo type of game and he has half of it built...will the move include his progress or will it make him start from the begining of the game?
    i dont want to use the same apps in two different iPads, i just want to transfer his to a new one and leave my wifes in her ipad.
    Please let me know if you need more information in order to help me.
    Thanks Again

    Have your wife transfer all purchases from the iPad into iTunes, backup her iPad and then sync with iTunes. Everything ... All media and other content will be available in that iTunes library and she will have a current backup.
    Assuming that your son will still be sharing your wife's Apple ID (he is too young to have one of his own) .... When you set up his iPad, restore the iPad from your wife's backup and then select only the content that you want your son to have on his iPad in the iTunes library and then sync that iPad with iTunes.
    The game progress is stored in the backup and should transfer onto his device when you restore from your wife's backup. You can always delete any content (apps, movies, music) that you don't want your son to have on the iPad, if you missed it when you synced with iTunes after setting the device up for him.
    You can set your sync preferences - any way that you want to - for both devices and still use the same iTunes library for both iPads. So ... Yes you can sync any apps that you want to his iPad and any apps that your wife wants to her iPad. You just need to restore your son's iPad from your wife's backup in order to get his game progress onto his iPad.
    In case you need these....
    Transfer purchases.
    http://support.apple.com/kb/HT1848
    How to backup and restore from a backup
    http://support.apple.com/kb/HT1766
    Remember to have your wife backup her iPad just before you restore his iPad from the backup so that his most recent progress will be available in the backup.

  • Help with Multiple VLANS and IP Phone Setup.

    Although i have a 3com, I have a cisco IP Phone. I have the IP Phone connected to the 3com swithport using a hybrid port. It's a tagged member of vlan3 (voice net) and an untagged member of vlan1(native data)
    The ip phone gets the right DHCP address for vlan3 ( 10.x.x.x ) but the laptop connected to the ip phone gets the IP for vlan 3 as well.
    I want the laptop to get the IP of the native vlan ( 192.168.x.x)
    what would the port setup need to be ? does it need to be a trunk ? i have the PVID of the port set to vlan3, this allows the IP phone to get its vlan3 DHCP address.
    any help would be greatly appreciated.
    The 3com OS is very similar to the latest of CISCO IOS'.
    so explain wtih syntax and i'm sure the 3com can relate.

    Based on your description of a 'Hybrid Port' this sounds like Cisco's 'Multi-VLAN Port' that was a feature of the 2900XL/3500XL series switches. This feature has however long since gone......
    With a Cisco switch an access port supporting an Access VLAN & a Voice VLAN is effectively a Trunk with only one Tagged VLAN and the Native VLAN:
    interface FastEthernet0/1
    switchport mode access
    switchport access vlan 10
    switchport voice vlan 100
    This results in the same configuration as:
    interface FastEthernet0/1
    switchport mode trunk
    switchport trunk encapsulation dot1q
    switchport trunk native vlan 10
    switchport trunk allowed vlan 100
    With the exception of CDP packets being sent advertising the Voice VLAN.
    With regards to other IP Phone vendors and DHCP Vendor Options - the answer is it depends....
    Nortel use Vendor Option 144 to inform the IP Phone of the Voice VLAN and Option 128 for the Server (PBX) to use. Ericsson uses Vendor Option 43 that can be configured to tell the IP Phone the VLAN and the Web server to read the config file from.
    I don't think you will get this working automatically with your 3Com switches, you can however manually configure the VLAN on the Cisco IP Phones.
    HTH
    Andy

  • Help with multiple iPhones and Apple ID!

    I have my iPhone 5S and my iPad Mini hooked up to my Apple ID. I recently gave my friend my old iPhone 4 for his birthday and it is also using my Apple ID. Whenever he changes/deletes the contacts in his phone, it changes mine. Is there any way to stop this but still allowing him to keep using my Apple ID?

    No, not unless one of you stops syncing contacts with iCloud.  When you share an iCloud account, all devices see the same data and any actions taken on one device is mirrored on all the others.

  • Help with multiple monitors and a Kona card

    I am trying to get a multi window setup but after I added the Kona card my browser keeps defaulting to the video monitor. I can access it with a mouse but is very inconvenient. How do I get FCP to ignore that monitor which is being driven by the Kona card??
    Thanks
    John

    I think I have it worked out. I put the Kona card in "input passthrough" mode and all seems to work just fine. I had it in MacIntosh desktop and that was causing my problem
    If any other suggestions I am sure open to them.
    Thanks
    John

  • Help with multiple accounts and email sharing

    I am trying to setup a computer for a non-profit and all users need to have access to the same Entourage email account. Is there a way to set this up so each user still has their own OS X account but access the same Entourage email account?
    Message was edited by: widowmaker

    1.  Is it possible to maintain more than one account on a single iPad?
    Not at the same time.

  • Help with exporting document and generating an enumerated value error

    Can anyone help me figure out why I cannot get this script to export the document and save it for the web?
    I keep getting the same frustrating "Enumerated Value expected".
    here is the script thus far:
    * attempting to create a script to insert names automatically within photoshop cs2. Similar to the PSP.
    tag = app.activeDocument;
    var lee = ["Barb","Belle","Betty","Carmel","Christy","Connie",
    "Debbie","Debra","Denise","Diamond","Dolceluna","Irene","Jacqui"];
    //determine if active layer is a text layer or not.
    if(tag.isBackground == true){
    alert("this is a background layer and cannot be changed.");
    else{
    alert("this is the name layer.")
    for(i=0;i<lee.length;i++){
    tag.activeLayer.textItem.contents = lee[i];
    var options = new ExportOptionsSaveForWeb();
    options.format = SaveDocumentType.PNG-24;
    options.interlaced = false;
        options.PNG8= false;
    var fName = lee[i];
    var newName = fName+'-'+tag.name+'.png';
    alert(newName);
    //EXPORT DOCUMENT KEEPS GENERATING ENUMBERATED VALUE EXPECTED
    // web.matte = MatteType.NONE;
    tag.exportDocument(File(tag.path + '/' + newName),ExportType.SAVEFORWEB,options);
    } // closes for loop
    }// end of else statement

    Yes the guide is misleading. It says 'For this property, only COMPUSERVEGIF, JPEG, PNG-8, PNG-24, and BMP are supported.'
    It really should say 'For this property, only COMPUSERVEGIF, JPEG, PNG, and BMP are supported.'
    But if you look under SaveDocumentType you will not find PNG-8 or PNG-24 listed in the values.

  • Need help with a recordset

    I need some help with a recordset that selects a series of
    vehicle makes that then show models when a make is selected. The
    problem is when I select the make it shows a list of models like it
    should, some of the make lists have five models and some have ten
    or more. What I need help with is how to limit the list to just the
    models and not include the "null" values. This makes my drop down
    list have large empty spaces at the end of the options listed. The
    query is as follows:
    SELECT *
    FROM saa.vehicle_make
    WHERE make = '#FORM.select_make#'
    Question # 2:
    What can I add to this recordset so that I can search on just
    the make alone without the model included. The submit includes both
    of the make and model lists so that makes it tough to break up.
    Here is the recordset:
    SELECT make
    FROM saa.vehicle_make
    ORDER BY make ASC
    Thanks
    Shane

    Sorry I guess I wasn't being clear. The lists work fine with
    the present recordsets but I was trying to clean them up just a
    little. I am using a table in mysql instead of an array for ease of
    maintenance due to the high number of makes and models I am working
    with.
    For question number one I was looking for sql that allows me
    to only show the models in the table for each make no matter how
    many are in the row. Currently when I use the existing recordset I
    get a long list of blank spaces as it is returning the "null"
    fields also. I would like it to just show the models and stop at
    the first null field.
    For the second question I wanted to be able to submit the
    form with just the make listed if someone wanted to see all Hondas
    lets say. Not I have to select the make also so it limits the
    return.
    Thanks for all of the input
    Shane
    Here is the code I am using for the two dependent select
    boxes:
    <p align="center">Vehicle Search by
    Make/Model</p>
    <!--- store the selected make variable after the first
    select boxes submits itself --->
    <cfif isDefined('form.select_make')>
    <cfset page.select_make = form.select_make>
    </cfif>
    <cfoutput>
    <form name="DropDown" method="post">
    <!--- query DB for the first drop down list --->
    <cfquery name="get_make" datasource="saa">
    SELECT make FROM saa.vehicle_make ORDER BY make ASC
    </cfquery>
    <!--- first drop down list --->
    <!--- NOTICE the onChange javascript event in the select
    tag, this is what submits the form after the first selection
    --->
    <p align="center">Model:<select name="select_make"
    required="yes" onchange="this.form.submit()">
    <option>Select Make</option>
    <!--- dynamically populate the first drop down list based
    on the get_make query --->
    <cfloop query="get_make">
    <option value="#make#" <cfif
    isDefined('form.select_make')><cfif form.select_make eq
    "#make#">selected</cfif></cfif>>#make#</option>
    </cfloop>
    </select></p>
    <!--- if the first selection has been made, display the
    second drop down list with the appropriate results --->
    <cfif isDefined('form.select_make')>
    <!--- query DB for second drop down list, based on the
    selected item from the first list --->
    <cfquery name="get_model" datasource="saa">
    SELECT * FROM saa.vehicle_make WHERE make =
    '#FORM.select_make#'
    </cfquery>
    <!--- second drop down list --->
    </cfif>
    </form>
    </cfoutput>
    <cfoutput>
    <form action="buyerModelSearchresults.cfm"
    method="POST">
    <p align="center">Model: <select name="model"
    required="yes">
    <option>Select Model</option>
    <!--- dynamically populate the second drop down list
    based on the get_make query --->
    <cfloop query="get_model">
    <option value="#model1#">#model1#</option>
    <option value="#model2#">#model2#</option>
    <option value="#model3#">#model3#</option>
    <option value="#model4#">#model4#</option>
    <option value="#model5#">#model5#</option>
    <option value="#model6#">#model6#</option>
    <option value="#model7#">#model7#</option>
    <option value="#model8#">#model8#</option>
    <option value="#model9#">#model9#</option>
    <option value="#model10#">#model10#</option>
    <option value="#model11#">#model11#</option>
    <option value="#model12#">#model12#</option>
    <option value="#model13#">#model13#</option>
    <option value="#model14#">#model14#</option>
    <option value="#model15#">#model15#</option>
    <option value="#model16#">#model16#</option>
    <option value="#model17#">#model17#</option>
    <option value="#model18#">#model18#</option>
    <option value="#model19#">#model19#</option>
    <option value="#model20#">#model20#</option>
    <option value="#model21#">#model21#</option>
    <option value="#model22#">#model22#</option>
    <option value="#model23#">#model23#</option>
    <option value="#model24#">#model24#</option>
    <option value="#model25#">#model25#</option>
    </cfloop>
    </select>
    </p>
    <p align="center">Search by Make/Model:</p>
    <p align="center"><input type="submit" name="Submit"
    value="Submit"></p>
    </form>
    </cfoutput>

  • Can bookmarks be protable for multiple computers? Is it an option to log on and use my bookmarks with multiple computers and locations? Thanks

    Can bookmarks be protable for multiple computers? Is it an option to log on and use my bookmarks with multiple computers and locations? Thanks

    Profile is a folder which store all your personal data in a safe place
    * https://support.mozilla.com/en-US/kb/Profiles
    You can use this button to go to the current Firefox profile folder:
    * Help > Troubleshooting Information > Profile Directory: Open Containing Folder
    here explain how to backup profile
    * https://support.mozilla.com/en-US/kb/Backing%20up%20your%20information
    Here explain how to restore it
    *https://support.mozilla.com/en-US/kb/Recovering%20important%20data%20from%20an%20old%20profile

  • Import Illustrator File with multiple layers and sublayers as composition retaining all layers and sublayers

    I have drawn a country map with multiple layers and sublayers including streets, cities, rail lines, ...
    Now I want to create a template for my collegues in After Effects.
    For this I want to import the .ai file into After Effects retaining all sublayers and layers in compositions and subcompositions.
    When I do that, I get the first couple of layers correctly, the other ones comes in one merged composition.
    What can I do, to get all layers each as a layer in After Effects?
    Yours, Raphael

    Illustrator only imports the first level of layers. If you have groups or paths below you need to release the groups to layers. The layers will then be stacked in order as sub layers. Then you need to move them up.
    The steps are to select a layer in the Illustrator layer panel, then without selecting any specific element in the layer click on the menu in the top right corner and select release to layers. All a elements in that layer will be converted to layers. Now select them all and drag them up above the original layer. This will leave the original layer empty and put all elements in new layers.
    Here's a tutorial I did a zillion years ago which uses this technique to turn a blend into a morph.
    Morphing With Adobe Illustrator. I hope this helps.

  • How do you download all chapters of a video at once?  I purchased a yoga video with multiple chapters and only the first one loaded.  It says I can't download another chapter for 90 days.

    I purchased a yoga video with multiple chapters and only the first one loaded.  It says I can't download another chapter for 90 days.  How do I get all chapters to download?

    Once a device or computer is associated with your Apple ID, you cannot associate that device or computer with another Apple ID for 90 days.
    http://support.apple.com/kb/ht4627

  • With multiple iPhones and iPad, how do you keep from downloading data from one device to another? ie, my calander ended up on my daughter's iPad.

    With multiple iPhones and an iPad, how do I keep from downloading info from one device to another? All of my info, example my calendar, ended up on my daughter's iPad.

    Each device has its own sync preferences with iTunes when syncing multiple devices with the same iTunes library under the same computer login account.
    If sync calendars with the same calendar is selected under the Info tab for your daughter's iPad sync preferences with iTunes, the same calendar will be synced with her iPad.

  • TO DRAW A TABLE WITH MULTIPLE ROWS AND MULTIPLE COLOUMNS IN FORM

    Hi,
       How to draw a table with multiple rows and columns seperated by lines in form printing?

    check this
    http://sap-img.com/ts003.htm
    Regards
    Prabhu

Maybe you are looking for