JList problems: howto use my own indexes taken from database.

Hello, I'm new to Java.
I'm reading names and Unique ID from my employee table. but when selected from listbox I want to get ID of my employee not SelectedIndex of jList is there any ready solution or what can you advice.
Example:
ID NAME
1 Fayziddin Jurayev
2 Sanjar Sharipov.
48 Muhammad Jurayev
49 -----XXXXX================> This record has been deleted
50 Sanjar Sharipov
As you see here two person have the same name also looking for person in the table using name will cause mistakes. But if I use SelectedIndex of person in a listbox again I make mistake as 49 th record is deleted.
I think best solution is to store at the array somewhere NAMES and ID's and use ID to recognize correctly selected person.
Can someone advice the easiest way to do it(I've used Visual Fox Pro before JAVA)
Thanks

Check out this posting:
http://forum.java.sun.com/thread.jspa?forumID=57&threadID=608684

Similar Messages

  • My daughter's older Ipod Touch is having a problem with images becoming pixilated when taken from an e-mail and placed into her camera roll. ( She wants to put on Instagram ) Any help?

    My daughter's older Ipod Touch is having a problem with images becoming pixilated when taken from an e-mail and placed into her camera roll. ( She wants to put on Instagram ) Any help?

    I think that may be a consequence of the email provider she is using. Some services (AOL is one example) inspect and modify email attachments, particularly photos, resulting in reduced resolution compared to the email that was sent.
    The iPod does not do this. The resolution of the picture in the email she receives will be identical to what is imported.

  • TS2755 Hi all, I bought one iphone and 3 ipads, i set up all on one apple ID. Now i have a problem when using messages: when sending message from one device it appears again on screen from the other 3 devices. I need help of how to set up messages on each

    Hi all, I bought one iphone and 3 ipads, i set up all on one apple ID. Now i have a problem when using messages: when sending message from one device it appears again on screen from the other 3 devices. I need help on how to set up messages on each device separately and to start using messages app on each device independently. Thanks

    search google for "iphone remove picture from contact"

  • How can I do to use my adobe cs3 taken from my old powewrbook to my new Imac?

    How can I do to use my adobe cs3 taken from my old powewrbook to my new Imac?

    Well, sorry to bring you the bad news, but you can stop right there. CS3 is not compatible with OSX 10.8 or 10.9.
    Mylenium

  • I use my own color profiles from Photoshop CS6/Mac Pro - how do I turn of Epson Artisan 837 printer color management?

    I use my own color profiles from Photoshop CS6/Mac Pro - how do I turn of Epson Artisan 837 printer color management?

    Choose Photoshop Manages Color in the CS6 print dialogue. At the top, click the Print Settings button and disable any color management settings for the printer.
    Edit: Correction, that's CS6 in Snow Leopard. In Mountain Lion, if you check the print settings, color management for the printer should automatically be disabled when using Photoshop Manages Color.

  • How do I program the use of Z index on a database table

    Hello friends,
    I need an example of an ABAP  program where the use of a customer defined index (, i.e. Z**) on a DB table is forced.
    I do not want to use primary index. I've created an index and I want to use / force my own index in the program.
    Any ideas please?
    Thanks for your help.

    Hi,
    As per my knowledge Nothing to specify as secondary index in program.
    Regards
    Md.MaahboobKhan

  • Is it possible to import songs from an old apple id into the library on my new computer, but then use my own apple id from then on?

    Okay so I'm about to start college and I just got my own macbook. Up until this point, I have been using my dad's apple ID for all my music and apps and stuff (on my other computers at home) but now that I got my own computer, I have my own apple ID as well, and I'd like to start using that ID from now on.
    So my question is, is there a way for me to get my old music library (which was controlled by my dad's apple ID) onto my new mac, but from that point on, start using my own apple ID for purchases?
    All I want from his ID is that library, because it's the music I have on my ipod and iphone. Once I have all that music on my new computer I want to be able to make purchases with my personal apple ID instead of his. Like I said, all I want is his library.
    I'm not sure how to accomplish any of this... so if anyone could help me out that'd be great! I'm so confused.
    Sorry if this was confusing lol I hope it makes sense

    ....... is there a way for me to get my old music library (which was controlled by my dad's apple ID) onto my new mac, but from that point on, start using my own apple ID for purchases?........
    Yes, once the content is in iTunes on your computer, just click it to play and authorise your computer to play it by entering your Dad's ID and password.
    Log into your own account and start purchasing your own content which will then be added to the existing content.

  • Problem in using the Web Service generated from BAPI_FLIGHT_GETLIST

    Hi all,
       I am trying to use the Web Service generated from BAPI_FLIGHT_GETLIST. I have got the wsdl file, and trying to invoke it. But, while I can test the BAPI using the Airline ID AA, I can't test from the Web Service using the same data. It shows the error message - "Airline AA not found". Anyone having solution, please help. This is urgent.
    Thanks,
    Anirban
    Message was edited by:
            Anirban Das

    Yes, I am connecting to the same system where we have data..
    Anirban

  • Setting the Data into a DropDownListBox in index.jsp from DataBase

    Hi,
    I want to put some data in dropdownlist.
    // in PageFlow Controller class
    public String[] items = {"aaa","bbb","ccc"};
    and in index.jsp
    <netui:select optionsDataSource="{pageFlow.items}" dataSource="{actionForm.selections}">
    I run the index.jsp and getting the dropdownlist with items aaa,bbb and ccc.
    Now I place a method in begin() method
    String[] items = conn.getData();//which returns data from database
    but the begin() method is not executed when I run the index.jsp after that I put the code
    String[] items = conn.getData(); in action() method
    it is giving the dropdownlist but after submitting the form i.e after calling the action.
    please tell me how the items will be set to listbox before action i.e when I run the index.jsp.Where can I put the code
    String[] items = conn.getData();
    and why the begin() method is not invoking.
    Regards,
    Sivaram

    Hi,
    I'm not sure if you have solved this yet?
    The issue you are facing is that you are loading the JSP directly. When you do this the pageflow will not be called and so the begin function not called.
    If you simply enter the URL of the pageflow instead of the JSP this will call the begin function, loading your dropdown values, and it should then redirect through an action to your index.jsp
    Hope that this helps
    Cheers
    IV

  • Setting the Data into a DropDownList in index.jsp from Database

    Hi,
    I want to create a Dynamic dropdownlist.
    // in PageFlow Controller class
    public String[] items = {"aaa","bbb","ccc"};
    and in index.jsp
    <netui:select optionsDataSource="{pageFlow.items}" dataSource="{actionForm.selections}">
    I run the index.jsp and getting the dropdownlist with items aaa,bbb and ccc.
    Now I place a method in begin() method
    String[] items = conn.getData();//which returns data from database
    but the begin() method is not executed when I run the index.jsp after that I put the code
    String[] items = conn.getData(); in action() method
    it is giving the dropdownlist but after submitting the form i.e after calling the action.
    please tell me how the items will be set to listbox before action i.e when I run the index.jsp.Where can I put the code
    String[] items = conn.getData();
    and why the begin() method is not invoking.
    Regards,
    Sivaram

    Hi,
    I'm not sure if you have solved this yet?
    The issue you are facing is that you are loading the JSP directly. When you do this the pageflow will not be called and so the begin function not called.
    If you simply enter the URL of the pageflow instead of the JSP this will call the begin function, loading your dropdown values, and it should then redirect through an action to your index.jsp
    Hope that this helps
    Cheers
    IV

  • Problem in Using Time Stamp when Querying from SQl Server to ODBC linked server

    I am using Following Query for my subject pupose but facing different Issues, Error Also shown after Query
    Query IS:
    DECLARE @sql varchar(8000)
    SELECT @sql = 'SELECT * FROM OPENQUERY(TEST, ' +
                  '''SELECT * FROM SCHEMA.OAUSER.Tag_Value ' +
                  'WHERE Tag_id = ''''GROUP_1SEC.COOLING_TOWERS.MOTORS.AG001.CURRENT.CV'''''+
                  ' AND timestamp = ''''{ts ''''2014-z02-18 15:28:38'''' }'''''')'
    PRINT @sql
    EXEC(@sql)
    And i am getting this Error:
    OLE DB provider "MSDASQL" for linked server "TEST" returned message "[DataDirect][OpenAccess ODBC]Syntax error in SQL statement. syntax error line 1 at or after token <2014>.".
    Msg 7321, Level 16, State 2, Line 1
    Please Guide me.
    Regards;
    Siraj

     Sorry "Z" was written by mistake
    I am using :
    DECLARE @sql varchar(8000)
    SELECT @sql = 'SELECT * FROM OPENQUERY(TEST, ' +
                  '''SELECT * FROM SCHEMA.OAUSER.Tag_Value ' +
                  'WHERE Tag_id = ''''GROUP_1SEC.COOLING_TOWERS.MOTORS.AG001.CURRENT.CV'''''+
                  ' AND timestamp = ''''{2014-02-18 15:28:38}'''''')'
    PRINT @sql
    EXEC(@sql)
    And Getting this error:
    OLE DB provider "MSDASQL" for linked server "TEST" returned message "[DataDirect][OpenAccess ODBC]Error getting the literal value of right operand.".

  • Create SSRS report using Schedule Perfomance Index(SPI) from mpp file

    Hi,
    We have project server data available in sql server. We need to create SSRS report to show schedule performance Index(SPI) of each week of all the projects. So we have the TaskSPI data available in MSP_EPMTask_Userview table. But the corresponding project
    status date is represented once for each projects. Is the weekly status dates keeping anywhere in the database? How can achieve this functionality?
    Regards,
    Julie

    Hi Julie,
    SPI is calculated at task level and is also a timephased indicator (since BCWP and BCWS are also timephased). There are calculated based on the status date (project tab in the ribbon) which is at project level. The project status date is not kept in
    time, this is a unique value thus you do not have a weekly status date.
    Do you mean you want to keep an history of each value of the status date? Does it really make sense?
    Hope this helps,
    Guillaume Rouyre, MBA, MVP, P-Seller |

  • Having problem with adding and reading dates to/from database !!!

    Hi
    I am new in J2ME
    I am trying to code a simple software.
    My problem is with dates.
    I have a datefield on my menu and the user will choose the date from here. By default, datefield shows todays date. But when I try to write that date to database using rms, date value transforms to java.util.Date@acfdb0fe.
    As I read from tutorials this is common problem of date class, so I tried to use calendar class.
    But with Calendar class I cannot let user to choose date from screen like DateField. datefield dowsn't work with calendar.
    later, I will use that date for sorting records
    Summary : I need a sample code that read date from screen (preferably with datefield), write it to recordstore. and then read it from recordstore asnd write to screen.
    I searching internet for a sample code through days.
    Please help me
    Thanks

    Hi,
    The best i would suggest is instead of storing the date as 19 Jan 2004 or something like this better store the date in milliseconds.
    DateField df = new DateField();
    Date d = df.getDate();
    long ms = d.getTime();
    store the value of ms in RMS. This is the commonly used way to store date in RMS for j2me.
    You can get back date using
    Date d = new Date(ms);
    DateField df = new DateField();
    df.setDate(d);
    Prabhu.

  • Stroring data taken from database as a variable

    Hi there I;m having a problem and I was wondering if anyone can help me?
    I am trying to extract data from a MySQL database and store the variables so I can use them in another bean...
    so far I am getting a SQL exception error but I dont know what Im doing wrong.......
    My bean code is :
    public int getAge(int age) throws SQLException, Exception{
    if(con != null){
    try{
    String userName = null;
    ResultSet rs;
    Statement stmt = con.createStatement();
    rs = stmt.executeQuery("SELECT (age) FROM gymuser WHERE Username='" userName "'");
    age = rs.getInt("age");
    return age;
    } catch(SQLException sqle){
    error = "SQLException: could not search gymuser";
    throw new SQLException(error);
    catch(Exception e){
    error = "An exception occured while searching gymuser";
    throw new Exception(error);
    } else {
    error = "Exception: connection to database was lost";
    throw new Exception(error);
    The JSP that calls this is :
    <%@page contentType="text/html"%>
    <%@page pageEncoding="UTF-8"%>
    <%@page import="java.sql.*, java.io.*, java.util.*;"%>
    <jsp:useBean id="details" scope="session" class="fitness.DBQuery" />
    <jsp:useBean id="conn" class="fitness.DBConnect" />
    <jsp:useBean id="currentuser" scope="session" class="fitness.currentuserBean" />
    --%>
    <%--
    <%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
    --%>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>GetDetails</title>
    </head>
    <body>
    <h1>GetDetails</h1>
    <%
    int age = 0;
    String userName = currentuser.getName();
    conn.connect();
         details.setCon(conn.getCon());
         details.getAge(age);
    conn.disconnect();
    %>
    </body>
    </html>
    Any help you have to offer would be greatly appreciated as Im desperate!! :-)

    Thanks for your help, greatly appreciated....
    I havent ever had to use DTO's before as this is the first time in my project where I need t use databasa data as variables in other classes.....so I should have a classthat looks like this ??: /*
    * GymUser.java
    * Created on 26 April 2007, 13:02
    * To change this template, choose Tools | Template Manager
    * and open the template in the editor.
    package fitness;
    import java.sql.*;
    import java.io.*;
    import java.util.*;
    import java.util.Date;
    import java.io.Serializable;
    * @author Hegstatic
    public class GymUser implements Serializable{
        /** Creates a new instance of gymUser */
         private String error;
         private String userName;
         private int age; // + getter + setter
        private double weight;
        private String gender;
        public int getAge(){
             return age;
        public void setAge(int i)
             age = i;
        public double getWeight()
            return weight;
        public void setWeight(double d)
            weight = d;
        public String getGender()
            return gender;
        public void setGender(String string)
            gender = string;
        Connection con;
        private String Frankie;
    public GymUser getGymUser()
                     if(con != null){
                     try{
                    ResultSet rs;
                    Statement stmt = con.createStatement();
                   rs = stmt.executeQuery("SELECT * FROM gymuser WHERE Username='" +Frankie+ "'");
                    List<GymUser> gymUsers = new ArrayList<GymUser>();
                    while (rs.next()) {
                        GymUser gymUser = new GymUser();
                        gymUser.setAge(rs.getInt("age"));
                        gymUser.setWeight(rs.getDouble("weight"));
                        gymUser.setGender(rs.getString("gender"));
                        gymUsers.add(gymUser);
        return gymUsers;
                     } catch(SQLException sqle){
                   error = "SQLException: could not search gymuser";
                    throw new Exception(error, sqle);
                   catch(Exception e){
                   error = "An exception occured while searching gymuser";
                   throw new Exception(error);
                    } else {
                   error = "Exception: connection to database was lost";
                   throw new Exception(error);
        }The IDE is telling me that the value I have for
    return gymUsers; is wrong...
    Was just wondering if I am going in the right direction and how would I call the variables age, weight, gender in a JSP page??
    Again Thank you !!
    Hegtic

  • Problem populating html form fields with data from database.

    I'm using a straight forward piece of code to populate a form with data from a database, to create and 'edit record' page. The code is as follows;
    TO RETREVE THE DATA FROM THE DATABASE;
         $query = "SELECT * FROM $table WHERE newsletter_id = '$newsletter_id'" ;
         mysql_select_db($database) ;
         $result = mysql_query($query, $connect);
         $numRows = mysql_num_rows($result);
         $dbnewsletter_title = mysql_result($result,$i,'newsletter_title');
    TO POPULATE THE FORM FEILD;
    <tr>
              <td width="140"><p class="admin">Newsletter title</p></td>
              <td><input name="newsletter_title" type="text" <? print "value=$dbnewsletter_title";}?> /></td>
            </tr>
    However, when I view the page, the string shows in the text feild, but seems to be split at the point of the first space. So basically only the first word of the string shows in the text field. If I try to print '$dbnewsletter_title' outside of the table, the string is shown in full as it should be.
    Does anyone know what is causing this problem?
    Many Thanks

    Put the value in quotes:
    <?php print "value='$dbnewsletter_title'"; ?>

Maybe you are looking for

  • Lenovo B6000 Bootscreen freeze, solutions ? (Windows 8)

    I bought a Lenovo B6000 Yoga 8 less than a year ago from Amazon.de.  Mainly for trips and mainly for the big battery otherwise I still am kicking myself now for choosing the Lenovo over the Nexus 7. Anyway, too late for that now. My first problem was

  • Thard party Purchase requisition From Production order

    Hi , We have a Concept like third party PR ( Purchase Requisation) should raise Thorugh Production order Normally We are raising the PR based on Sales Order and Item category is TAS, But my clint Want some of the material in Production BOM After runn

  • How to extract .bin file on mac?

    Dear Team,                  How to extract .bin file on mac os ? please help me regards, kalai

  • Trim extra spaces (the easy way)

    Sometimes, the fields from my resultset will have extra spaces at the end. Is there an easy way to simply trim the space when selecting a value? For instance, say there is extra space on this Date field, is there no trim-space type function? <xsl:val

  • Need brief explanation on new Drive Q: topic

    hi, could somebody provide a quick explanation or a link  (before I will dive deep into the docs and theory) of new features/functions of drive Q: sequencer and most interesting on client. If possible compare with what was in 4.6 thx. "When you hit a