How can i get value when the field name is user's defined

Hi,
I have a one java method:
public ResultSet countUserDb(String id) {
ResultSet rs = null;
con = dbcon.connect();
String queryString = ("select count as count from
db_allocation where user_id='"+id+"'");
Statement stmt = con.createStatement();
rs = stmt.executeQuery(queryString);
When i call it in a jsp file.
ResultSet counter =db.countUserDb(request.getParameter("id"));
if(counter.next())
int x=rs.getInt("count");
Tomcat said incorrect column name.How can i get the result set when the field name is user's defined.
Best regards
Ricky

You should give the user defined name in the ResultSet.getXXX method to retrieve the column value.
Example
SQL:
Select ename as employeename from emp;
You should say :
ResultSet.getString("employeename"); to get the value.
Alternatively you can retrieve it using column number:
ResultSet.getString(1);
Chandar

Similar Messages

  • How can i get the value when the field name is user defined

    Hi,
    I have a one java method:
    public ResultSet countUserDb(String id) {
    ResultSet rs = null;
    con = dbcon.connect();
    String queryString = ("select count(*) as count from
    db_allocation where user_id='"+id+"'");
    Statement stmt = con.createStatement();
    rs = stmt.executeQuery(queryString);
    When i call it in a jsp file.
    ResultSet counter =db.countUserDb(request.getParameter("id"));
    if(counter.next())
    int x=rs.getInt("count");
    Tomcat said incorrect column name.How can i get the result set when the field name is user's defined.
    Best regards
    Ricky

    Hi Ricky
    To access pseudo columns you can specify an alias or use the index on the column (e.g. getInt(1)).
    Chris
    NB: you should use bind variables instead of concatenating the id to the SQL statement.

  • How can I get rid of the values shown on x axis

    How can I get rid of the values shown on x axis ?
    The two diagrams are for illustrations .I want the A diagram like values and wanna get rid of 50 150 250 350on x axis
    Mudassar

    In Axis Options, set Interval to 1. Every category group label
    is displayed. If you want to show every other category group label on the x-axis, type 2.
    "If you want to show every other category group label on the x-axis, type 2."
    what does this mean ?
    when you set 1 as per it everything is shown and when you set 2 every other ????
    Any example on this ?
    Mudassar

  • I am running OS10.6.8 and have a mail box duplication. I use gmail and when I open my mail I have both the Apple Mail and another set of boxes for Gmail. Both get all mail and when I delete from one, it deletes from the other. How can I get rid of the dup

    I am running OS10.6.8 and have a mail box duplication. I use gmail and when I open my mail I have both the Apple Mail and another set of boxes for Gmail. Both get all mail and when I delete from one, it deletes from the other. How can I get rid of the dup

    Hi,
    According to your descriptioin, I don't think this is system problem, it should be Intel driver problem. It would be contact Intel to confirm this issue whether this is their driver problem.
    Roger Lu
    TechNet Community Support

  • I have an iPhone 6 with IOS 8.1.3 and when I use the landscape view in Safari, the bookmark page appears and takes up one half of the screen. How can I get rid of the bookmark page so I can have the whole screen to what I am browsing?

    I have an iPhone 6 with IOS 8.1.3. When I go to the landscape view in Safari, the bookmark page appears and takes up one half of the screen. How can I get rid of the bookmark page so I can use the whole screen to what I am browsing?

    OOPS! Too quick on the trigger to ask that question without trying anything. Sorry. Solved it by touching the bookmark icon.

  • I have a new iPad. I am using Comcast as my email provider but when I send a message, it pulls up the facebook email addresses for my  contacts  instead of the addresses stored in my comcast account.  How can I get rid of the Facebook email addresses? The

    I have a new iPad. I am using Comcast as my email provider but when I send a message, it pulls up the facebook email addresses for my  contacts  instead of the addresses stored in my comcast account.  How can I get rid of the Facebook email addresses? The comcast addresses are stored in the comcast (xfinity) app.  I do not use the "mail" or "contacts" apps ....I go straight to comcast (xfinity).  I wish I could start over!!!  thanks.
    iPad

    I could be wrong, but it sounds like Facebook imported to your contacts.  I have the Xfinity app on my new ipad, too, but none of my stored contacts from the online version are showing, only what I manually entered into the iPads contacts are there.  When I did add the FB app, I did not grant it permission to push and pull from my ipad (not a fan of FB knowing every detail about me), so that may be where our difference lies.  You could try to open the app and change your privacy settings, or delete it and then reinstall without granting permissions to integrate.
    I'm sure someone here with a lot more knowledge then me can probably diagnose your issue better, though.  Good luck!

  • I have 2 accounts in my family and would like to purchase some of the same songs for both accounts, however when I try to purchase a duplicate song from the second account the song says play instead of purchase. How can I get some of the same songs?

    I have 2 accounts in my family and would like to purchase some of the same songs for both accounts, however when I try to purchase a duplicate song from the second account the song says play instead of purchase. How can I get some of the same songs?

    Drrhythm2 wrote:
    What's the best solution for this? I
    Copy the entire /Music/iTunes/ folder from her old compouter to /Music/ in her account on this new computer.

  • My iPad is disabled, but I know the passcode.. When i connect it to iTunes it says it can't access it because it has a passcode. How can i get rid of the passcode without resetting the iPad? And if there is no way to do so, how do I completely reset it?

    My iPad is disabled, but I know the passcode.. When i connect it to iTunes it says it can't access it because it has a passcode. How can i get rid of the passcode without resetting the iPad? And if there is no way to do so, how do I completely reset it?

    How can I unlock my iPad if I forgot the passcode?
    http://www.everymac.com/systems/apple/ipad/ipad-troubleshooting-repair-faq/ipad- how-to-unlock-open-forgot-code-passcode-password-login.htmlhttp://www.everymac.com/systems/apple/ipad/ipad-troubleshooting-repair-faq/ipad- how-to-unlock-open-forgot-code-passcode-password-login.html
    iOS: Device disabled after entering wrong passcode
    http://support.apple.com/kb/ht1212http://support.apple.com/kb/ht1212
    How can I unlock my iPad if I forgot the passcode?
    http://tinyurl.com/7ndy8tbhttp://tinyurl.com/7ndy8tb
    How to Reset a Forgotten Password for an iOS Device
    http://www.wikihow.com/Reset-a-Forgotten-Password-for-an-iOS-Devicehttp://www.wikihow.com/Reset-a-Forgotten-Password-for-an-iOS-Device
    Using iPhone/iPad Recovery Mode
    http://ipod.about.com/od/iphonetroubleshooting/a/Iphone-Recovery-Mode.htmhttp://ipod.about.com/od/iphonetroubleshooting/a/Iphone-Recovery-Mode.htm
    You may have to do this several times.
    Saw this solution on another post about an iPad in a school environment. Might work on your iPad so you won't lose everything.
    ~~~~~~~~~~~~~
    ‘iPad is disabled’ fix without resetting using iTunes
    Today I met my match with an iPad that had a passcode entered too many times, resulting in it displaying the message ‘iPad is disabled – Connect to iTunes’. This was a student iPad and since they use Notability for most of their work there was a chance that her files were not all backed up to the cloud. I really wanted to just re-activate the iPad instead of totally resetting it back to our default image.
    I reached out to my PLN on Twitter and had some help from a few people through retweets and a couple of clarification tweets. I love that so many are willing to help out so quickly. Through this I also learned that I look like Lt. Riker from Star Trek (thanks @FillineMachine).
    Through some trial and error (and a little sheer luck), I was able to reactivate the iPad without loosing any data. Note, this will only work on the computer it last synced with. Here’s how:
    1. Configurator is useless in reactivating a locked iPad. You will only be able to completely reformat the iPad using Configurator. If that’s ok with you, go for it – otherwise don’t waste your time trying to figure it out.
    2. Open iTunes with the iPad disconnected.
    3. Connect the iPad to the computer and wait for it to show up in the devices section in iTunes.
    4. Click on the iPad name when it appears and you will be given the option to restore a backup or setup as a new iPad (since it is locked).
    5. Click ‘Setup as new iPad’ and then click restore.
    6. The iPad will start backing up before it does the full restore and sync. CANCEL THE BACKUP IMMEDIATELY. You do this by clicking the small x in the status window in iTunes.
    7. When the backup cancels, it immediately starts syncing – cancel this as well using the same small x in the iTunes status window.
    8. The first stage in the restore process unlocks the iPad, you are basically just canceling out the restore process as soon as it reactivates the iPad.
    If done correctly, you will experience no data loss and the result will be a reactivated iPad. I have now tried this with about 5 iPads that were locked identically by students and each time it worked like a charm.
    ~~~~~~~~~~~~~
    Try it and good luck. You have nothing more to lose if it doesn't work for you.
     Cheers, Tom

  • After installing Itunes 10.6.3 When ever I start the computer I get a pop up the says  "Applesyncnotifier.exe- unable to locate component, this application has failed to start because Corefoundation.dll was not found"  How can I get rid of the pop up?

    After installing Itunes 10.6.3 When ever I start the computer I get a pop up the says  "Applesyncnotifier.exe- unable to locate component, this application has failed to start because Corefoundation.dll was not found"  How can I get rid of the pop up?

    I hope it doesn't effect how I down load my itunes to my ipod and iphone.
    No you should be fine. (The MobileMe service is being shut down, anyway, so there should be no impact at all.)

  • I've lost my iPhone 4... How can I find it when the device is offline when using "find my iPhone app"????? Any way of getting a location from it????

    I've lost my iPhone 4... How can I find it when the device is off linesmen using "find my iPhone app"????? Any way of getting a location from it?????

    No. It must be online in order to locate it.
    What To Do If Your iDevice Is Lost Or Stolen
    iPhone, iPod Touch, and iPad
    If you activated Find My Phone before it was lost or stolen, you can track it only if it is connected to the Internet by Wi-Fi or cellular. What you cannot do is track your device using a serial number or other identifying number. You cannot expect Apple or anyone else to find your device for you. You cannot recover your loss unless you insure your device for such loss. It is not covered by your warranty.
    If your iPhone, iPod, iPod Touch, or iPad is lost or stolen what do you do? There are things you should have done in advance - before you lost it or it was stolen - and some things to do after the fact. Here are some suggestions:
    This link, Re: Help! I misplaced / lost my iPhone 5 today morning in delta Chelsea hotel downtown an I am not able to track it. Please help!, has some good advice regarding your options when your iDevice is lost or stolen.
      1. Reporting a lost or stolen Apple product
      2. Find my lost iPod Touch
      3. AT&T. Sprint, and Verizon can block stolen phones/tablets
      4. What-To-Do-When-Iphone-Is-Stolen
      5. iCloud- Use Lost Mode
      6. What to do if your iOS device is lost or stolen
      7. 6 Ways to Track and Recover Your Lost/Stolen iPhone
      8. Find My iPhone
      9. Report Stolen iPad | Stolen Lost Found Online
    It pays to be proactive by following the advice on using Find My Phone before you lose your device:
      1. Find My iPhone
      2. Setup your iDevice on iCloud
      3. OS X Lion/Mountain Lion- About Find My Mac
      4. How To Set Up Free Find Your iPhone (Even on Unsupported Devices)

  • I was adding items with the intent of command z 'ing them back to their original when it crashed, autosaved, and my original numbers were lost to the temp numbers plugged in... how can i get back to the previous version? Because it had closed, command z

    I was adding items with the intent of command z 'ing them back to their original when it crashed, autosaved, and my original numbers were lost to the temp numbers plugged in... how can i get back to the previous version? Because it had closed, command z

    Sorry, this happened in CLOUD numbers....

  • When starting Firefox 4 I get an error message. After clicking OK it nevertheless runs. How can I get rid off the error message.

    When starting up Firefox 4 I get an error message. After clicking OK it nevertheless runs. How can I get rid off the error message?
    The error message is: what happened: Type Error: Components. classes ['@mozilla.org/extensions/manager;1'] is undefined.
    It appears all the time already from the beginning after installing Firefox 4.

    Thanks a lot. The Ask toolbar created this problem. Another problem is: When searching on the web via Google, normally it is possible to type a few letters and then look what appears and then click on the wanted word(s). A number of word(s) ineed do appear, however it is not possible to select any of them as ws possible as mentioned in olders versions.

  • I lost my ipod and i remotely locked my ipod on the computer using icloud, but when click on find my ipod it says  NO DEVICES, how can i get back to the find my ipod page??? pliz help :(

    i lost my ipod and i remotely locked my ipod on the computer using icloud, but when click on find my ipod it says  NO DEVICES, how can i get back to the find my ipod page??? pliz help

    The only way you will be able to track that iPod is if it is turned on and connected to a wifi network by the person that has it.
    Basic troubleshooting steps  
    17" 2.2GHz i7 Quad-Core MacBook Pro  8G RAM  750G HD + OCZ Vertex 3 SSD Boot HD 
    Got problems with your Apple iDevice-like iPhone, iPad or iPod touch? Try Troubleshooting 101
     In Memory of Steve Jobs 

  • How can I get values from listbox?

    Hi all,
    I need to get price values from Price List (Inventory -> Item Master Data screen). It's important to get values from field 'Price' BEFORE item will be added/updated.
    How can I get values from Pricelist listbox?
    Thanks for any suggestions or short sample code.
    Best regards,
    Andy

    Hi Andy
    Here is som sample code that will get the description of the price list and also the price that is displaying at the time. The item master must be open for this snippet of code
      Public Sub GetItemPriceFromOpenWindow()
            'this is assuming item master is open
            Dim oEdit As SAPbouiCOM.EditText
            oEdit = SBO_Application.Forms.GetForm("150", 1).Items.Item("34").Specific
            SBO_Application.MessageBox(oEdit.Value)
            Dim oCmb As SAPbouiCOM.ComboBox
            oCmb = SBO_Application.Forms.GetForm("150", 1).Items.Item("24").Specific
            SBO_Application.MessageBox(oCmb.Selected.Description)
        End Sub
    Hope it helps

  • I have a Australian iTunes account and want to switch to using the u.s store as I now live there, I cannot do this because I have $1.41 still in the oz account an image to have a zero balance to change stores, how can I get rid of the $1.41?

    I want to switch to the u.s store as I now live in the us, I cannot switch stores because my balance is $1.41 in the oz store and needs to be zero, how can I get rid of the $1.41 when everything costs more or less than that? I do not have a credit card on the oz iTunes account an I cannot use my us one to top it up.
    HELP

    Click here and request assistance.
    (60992)

Maybe you are looking for