Id from one table showing value from another

I have an article id (rs_comments.id_com) but I would like it
to take this data and collect the value from another table.
I have joined the two tables with:
SELECT * FROM blg_comment_com INNER JOIN blg_article ON
idart_com=id_art
WHERE valid_com=1
ORDER BY date_com DESC
rs_comments.idart_com needs to be equal to rs_comments.id_art
displaying the value from rs_comments.title_art
How would I go about doing this. There only seems to be an
option in DW to do this with a dynamic list/menu but I just want to
display the text without option to change it.
Any help much appreciated.

i was stupid. The answer was staring me in the face. No
wonder no-one bothered to reply...

Similar Messages

  • Need to compare values in two columns of one table against values in two columns in another table

    Hi, as the title reads, I'm looking for an approach that will allow me to compare values in two columns of one table against values in two columns in another table.
    Say, for instance, here are my tables:
    Table1:
    Server,Login
    ABCDEF,JOHN
    ABCDEF,JANE
    FEDCBA,SEAN
    FEDCBA,SHAWN
    Table2:
    Server,Login
    ABCDEF,JOHN
    ABCDEF,JANE
    FEDCBA,SHAWN
    In comparing the two tables, I'd like my query to report the rows in table1 NOT found in table2. In this case, it'll be the 3rd row of table one:
    Server,Login
    FEDCBA,SEAN
    Thanks.

    create table Table1([Server] varchar(50), Login varchar(50))
    Insert into Table1 values ('ABCDEF','JOHN'),('ABCDEF','JANE'),('FEDCBA','SEAN'),('FEDCBA','SHAWN')
    create table Table2([Server] varchar(50), Login varchar(50))
    Insert into Table2 values ('ABCDEF','JOHN'),('ABCDEF','JANE'), ('FEDCBA','SHAWN')
    select [Server] ,Login from Table1
    Except
    select [Server] ,Login from Table2
    select [Server] ,Login from Table1 t1
    where not exists(Select 1 from Table2 where t1.[Server] = t1.[Server] AND Login=t1.Login)
    drop table Table1,Table2

  • I click on one song and another one starts playing.  Cover art for one artist shows up on another album.  All of my music isn't showing up.  Please help.  Why is this happening?  How can I fix it?

    I click on one song and another one starts playing.  Cover art for one artist shows up on another album.  All of my music isn't showing up.  Please help.  Why is this happening?  How can I fix it?

    Sorry for not getting back with you...
    That moves only the iTunes media, not the iTunes library (which is really kinda nebulous).
    iTunes library = iTunes folder and all the media, wherever it is located.
    The /Music/iTunes/ folder contains the iTunes library.itl file, which keeps track of everything in iTunes.
    I do however still have the original MAIN startup drive still in the computer, it's just not the startup.
    This is good you still have it.
    Try this...
    Hold Option and launch iTunes.
    Select Choose library... and select the /iTunes/ folder on the original drive. It should be in /Users/your_user_name/Music/.
    Don't mess with anything. We can get it cleared up.
    Does everything work okay?

  • How to copy one column BLOB value into another column of another database.

    How to copy one column BLOB value into another column of another database.
    BLOB value contains word document.
    I thought of copy the BLOB value into a text file and then update the new column value by the same text in textfile. Will this work?
    Is there any other better way to do this?

    You're welcome
    BLOB fields contains binary data. I don't think you can do this
    Also if I view the BLOB as text. Can I copy it and insert into the new database.
    I think your options are as I said. Datapump or CTAS
    Best Regards

  • How to read LONG RAW data from one  table and insert into another table

    Hello EVERYBODY
    I have a table called sound with the following attributes. in the music attribute i have stored some messages in the different language like hindi, english etc. i want to concatinate all hindi messages and store in the another table with only one attribute of type LONG RAW.and this attribute is attached with the sound item.
    when i click the play button of sound item the all the messages recorded in hindi will play one by one automatically. for that i'm doing the following.
    i have written the following when button pressed trigger which will concatinate all the messages of any selected language from the sound table, and store in another table called temp.
    and then sound will be played from the temp table.
    declare
         tmp sound.music%type;
         temp1 sound.music%type;
         item_id ITEM;
    cursor c1
    is select music
    from sound
    where lang=:LIST10;
    begin
         open c1;
         loop
              fetch c1 into tmp; //THIS LINE GENERATES THE ERROR
              temp1:=temp1||tmp;
              exit when c1%notfound;
         end loop;
    CLOSE C1;
    insert into temp values(temp1);
    item_id:=Find_Item('Music');
    go_item('music');
    play_sound(item_id);
    end;
    but when i'm clicking the button it generates the following error.
    WHEN-BUTTON-PRESSED TRIGGER RAISED UNHANDLED EXCEPTION ORA-06502.
    ORA-06502: PL/SQL: numeric or value error
    SQL> desc sound;
    Name Null? Type
    SL_NO NUMBER(2)
    MUSIC LONG RAW
    LANG CHAR(10)
    IF MY PROCESS TO SOLVE THE ABOVE PROBLEM IS OK THEN PLESE TELL ME THE SOLUTION FOR THE ERROR. OTHER WISE PLEASE SUGGEST ME,IF ANY OTHER WAY IS THERE TO SOLVE THE ABOVE PROBLEM.
    THANKS IN ADVANCE.
    D. Prasad

    You can achieve this in many different ways, one is
    1. Create another VO based on the EO which is based on the dest table.
    2. At save, copy the contents of the source VO into the dest VO (see copy routine in dev guide).
    3. commiting the transaction will push the data into the dest table on which the dest VO is based.
    I understand that if we attach VO object instance to region/page, we only can pull and put data in to only one table.
    if by table you mean a DB table, then no, you can have a VO based on multiple EOs which will do DMLs accordingly.Thanks
    Tapash

  • How to get the data from one table and insert into another table

    Hi,
    We have requirement to build OA page with the data needs to be populated from one table and on save data into another table.
    For the above requirement what the best way to implement in OAF.
    I understand that if we attach VO object instance to region/page, we only can pull and put data in to only one table.
    Thanks

    You can achieve this in many different ways, one is
    1. Create another VO based on the EO which is based on the dest table.
    2. At save, copy the contents of the source VO into the dest VO (see copy routine in dev guide).
    3. commiting the transaction will push the data into the dest table on which the dest VO is based.
    I understand that if we attach VO object instance to region/page, we only can pull and put data in to only one table.
    if by table you mean a DB table, then no, you can have a VO based on multiple EOs which will do DMLs accordingly.Thanks
    Tapash

  • I need help figuring out how to Link Data from one table in Sharepoint to another table in Sharepoint and make it dynamic

    Hi Everyone,
    I am working on a project that uses SharePoint 2010 for repository and we have multiple tables that we are using.
    One table is a list of the various projects we are working on (workstreams)
    The other is a table with various notes and such, to include meeting notes for the various projects.
    Currently we are just copying the shortcut from the meeting notes table and adding it in as a link in the workstreams status table.
    I need to find out if there is some sort of way to make this process dynamic so that when a new note is added for, lets say workstream #1 in the notes table, it will automatically propogate into the notes link section for workstream #1.
    Is this even possible??
    And if so how would I do it
    I haven't done much with modifying SharePoint in several years, and would Truly appreciate any and all help with this.
    Thanks in advance
    IKE

    Hi IKE,
    According to your description, my understanding is that you want to create a link in the workstreams list linked to the associated item of the notes list.
    Assuming the workstreams list has  Title column and another column called “Note” used to linked to notes list, and the notes list has Title column and another column used to store note.
    Then you can create a workflow on the notes list with SharePoint Designer 2010, and in the workflow, using “Update ListItem” action. And in the workflow Start Options, select “Start workflow automatically when an item is created”.
    For the workflow action, you can set as the screenshot:
    For the string in the String Builder, you need to open an item of notes list, then copy the URL of the display form and paste here, the URL will look something like this:
    http://sp/Lists/notes/DispForm.aspx?ID=1&Source=http%3A%2F%2Fsp%2FLists%2Fnotes%2FAllItems%2Easpx&ContentTypeId=0x0100300025278693CE49A5E3A394B23AD9E1&IsDlg=1
    Now, you need to replace the ID of the item using [%Current Item:ID%], for example in the above link, delete the number 1 and add [%Current Item:ID%].
    Best Regards,
    Wendy
    Wendy Li
    TechNet Community Support

  • How do I read from one table and write to another identical table?

    I am very new to Oracle. I am trying to do something that should be very simple.
    I am trying to read from one table in SQL and then write to another
    Identically formatted table. I keep getting various errors. Could someone please
    post some vey simple code that will work so that I can play around with it?
    Any help would be greatly appreciated.
    Thanks,
    Ron

    Thanks, but I must be missing something.
    I have two tables, SONGLIST and SETLIST.
    The second line by itself works just fine on either table.
    Here is the code I used following your seggestion, along with it's error message.
    Hope you can help. Thanks again...
    INSERT INTO SETLIST
    SELECT TITLE FROM SONGLIST WHERE ROTATION <> 'X'
    ORA-00947: not enough values

  • Looking data from more than one table and inserting into another.

    Hello,
    I am giving you the Table structures as per my requirement..
    CREATE TABLE TEMP_A
    (NAME VARCHAR2(100) primary key);
    CREATE TABLE TEMP_B
    (STRUCTURE VARCHAR2(10));
    CREATE TABLE TEMP_C
    ( NAME VARCHAR2(100),
    STRUCTURE VARCHAR2(10),
    VALUE VARCHAR2(10));
    Alter table TEMP_C
    add constraint fk_name_tempc foreign key(name) references TEMP_A(name)
    INSERT INTO TEMP_A VALUES('SMITH');
    INSERT INTO TEMP_A VALUES('ALLEN');
    INSERT INTO TEMP_A VALUES('WARD');
    INSERT INTO TEMP_A VALUES('JONES');
    COMMIT;
    INSERT INTO TEMP_B VALUES('IN');
    INSERT INTO TEMP_B VALUES('IN_MIN');
    INSERT INTO TEMP_B VALUES('IN_TYP');
    INSERT INTO TEMP_B VALUES('IN_MAX');
    INSERT INTO TEMP_B VALUES('DIP');
    INSERT INTO TEMP_B VALUES('TIM');
    COMMIT;
    INSERT INTO TEMP_c VALUES('SMITH','C1','');
    INSERT INTO TEMP_c VALUES('SMITH','C2','');
    INSERT INTO TEMP_c VALUES('SMITH','D1','');
    INSERT INTO TEMP_c VALUES('ALLEN','D2','');
    INSERT INTO TEMP_c VALUES('ALLEN','R1','');
    INSERT INTO TEMP_c VALUES('WARD','R2','');
    COMMIT;
    i want to say is it should insert into table 'TEMP_C' values as :
    For 'SMITH' there should be (6 * 3) = 18 records.
    ( 6 distinct values of TEMP_B for SMITH to be inserted into TEMP_C against 'C1')
    ( 6 distinct values of TEMP_B for SMITH to be inserted into TEMP_C against 'C2')
    ( 6 distinct values of TEMP_B for SMITH to be inserted into TEMP_C against 'D1')
    For 'ALLEN' there should be (6 * 2) = 12 records.
    ( 6 distinct values of TEMP_B for ALLEN to be inserted into TEMP_C against 'D2')
    ( 6 distinct values of TEMP_B for ALLEN to be inserted into TEMP_C against 'R1')
    For 'WARD' there should be (6 * 1) = 6 records.
    ( 6 distinct values of TEMP_B for WARD to be inserted into TEMP_C against 'R2')
    Like this if there are records for JONES also , it should also do the same way( Depending on the No. of records present
    in the table 'TEMP_C' for 'JONES').
    Thanks in advance,
    Amkotz

    Is this what you are looking for?
    SQL> insert into temp_c (name, structure, value)
      2  select c.name, c.structure, b.structure
      3  from temp_a a, temp_c c, temp_b b
      4  where a.name = c.name
      5  ;
    36 rows created.
    SQL> select * from temp_c;
    NAME    STRUCTURE  VALUE
    SMITH   C1
    SMITH   C2
    SMITH   D1
    ALLEN   D2
    ALLEN   R1
    WARD    R2
    SMITH   C1         IN
    SMITH   C1         IN_MIN
    SMITH   C1         IN_TYP
    SMITH   C1         IN_MAX
    SMITH   C1         DIP
    SMITH   C1         TIM
    SMITH   C2         IN
    SMITH   C2         IN_MIN
    SMITH   C2         IN_TYP
    SMITH   C2         IN_MAX
    SMITH   C2         DIP
    SMITH   C2         TIM
    SMITH   D1         IN
    SMITH   D1         IN_MIN
    SMITH   D1         IN_TYP
    SMITH   D1         IN_MAX
    SMITH   D1         DIP
    SMITH   D1         TIM
    ALLEN   D2         IN
    ALLEN   D2         IN_MIN
    ALLEN   D2         IN_TYP
    ALLEN   D2         IN_MAX
    ALLEN   D2         DIP
    ALLEN   D2         TIM
    ALLEN   R1         IN
    ALLEN   R1         IN_MIN
    ALLEN   R1         IN_TYP
    ALLEN   R1         IN_MAX
    ALLEN   R1         DIP
    ALLEN   R1         TIM
    WARD    R2         IN
    WARD    R2         IN_MIN
    WARD    R2         IN_TYP
    WARD    R2         IN_MAX
    WARD    R2         DIP
    WARD    R2         TIM
    42 rows selected.
    SQL>

  • How to assign One Dimension Property value to another Dimension ID

    Business senario:
    There are two dimensions Entity and Plant. Plant also has a property Entity.
    In my Input Form, I need to derive Entity Property based on PLANT selection and should map it to ENTITY Dimension.
    I have selected PLANT Dimension and ENTITY Dimension in Page Axis. I have updated EPMOLAPMember() formula with EPMMemberProperty() for deriving Entity values. When I tried to save data an error message appears saying TOT_Code is not a base level member. So I checked Edit Report window and found that ENTITY Dimension is automatically moved to default left panel from Row Axis and Entity Dimension Context Menu is mapped to TOT_Code which is the top node of the total hierarchy.
    I tried EPMMemberOverride() function to overwrite ENTITY Dimension values with Entity Property of PLANT Dimension but unable to overwrite it.
    In Simple Words:
    ENTITY Dimension = PLANT Dimension (Entity Property)
    Is there any way to map/assign property value to another dimension??? Please help me.
    Thanks in advance.

    Hi,
    see please this thread for a possible solution http://scn.sap.com/thread/3230754
    Regards
         Roberto

  • Getting list of items from one table indirectly associated with another

    I have a database containing 3 tables. One is a list of employees, one is a list of companies that are clients and another is the projects each employee is working on. The projects table is the only connection between the employee and the company. An employee is working on a project for a specific company. I need to find a list of companies someone is working for given the employee's ID. How would I do this? I've done direct queries before, but never anything that involves going through another table. I have an explanation of my tables below.
    Employee ------------- Project ----------- Company
    Name ------------------ Name --------------- Name
    ID -------------------> EmployeeID
    ------------------------ CompanyID ----------> ID

    I did something like this..It works for MS Access 2000 but not SQL Server 2000. (http://forum.java.sun.com/thread.jsp?forum=48&thread=270102)
    What I have is one main table, joined to 3 other tables, and each one of them have one category in common, and they are in a many-to-one relationship with the main table.
    The Function category in the main table is the same as the Function_Name category in the others
    For ex)
    Main Table
    Function Description Context Actions Notes
    sample blah blah blah blah
    Table 1
    Function_Name ArgName ID
    sample x 1
    sample y 2
    Table 2
    Function_Name Return_Codes ID
    sample z 1
    sample m 2
    sample n 3
    Table 3
    Function_Name Function_Called ID
    sample t 1
    What i needed to do was retrieve all these records from the different tables if I only had the value to the Name field.
    This is the code I used:
    <code>
    String dataSourceName = "<fill in your dataSourceName>";
    String dbURL = "jdbc:odbc:" + dataSourceName;
    try{
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    }catch (Exception e){System.out.println("Couldn't connect to driver.");}
    try{
    Connection con = DriverManager.getConnection(dbURL, "","");
    Statement stmt = con.createStatement();
    //gui3.staticName is the data in the Function or Function_Name Field
    ResultSet result = stmt.executeQuery("SELECT * FROM function_description WHERE (((Function)='"+ gui3.staticName + "'));");
    while(result.next()){
    function.setText(result.getString("Function"));
    description.setText(result.getString("Description"));
    notes.setText(result.getString("Notes"));
    actions.setText(result.getString("Actions"));
    context.setText(result.getString("Context"));
    ResultSet result2 = stmt.executeQuery("SELECT Return_Codes FROM return_code_description WHERE (((Function_Name)='"+ gui3.staticName + "')) ORDER BY Return_Codes ASC;");
    while(result2.next()){
    rCodes.addElement(result2.getString("Return_Codes"));
    ResultSet result3 = stmt.executeQuery("SELECT ArgName FROM Arg WHERE (((Function_Name)='"+ gui3.staticName + "')) ORDER BY ArgName ASC;");
    while(result3.next()){
    args.addElement(result3.getString("ArgName"));
    ResultSet result4 = stmt.executeQuery("SELECT Function_Called FROM Function_Called WHERE (((Function_Name) = '"+ gui3.staticName + "')) ORDER BY Function_Called ASC;");
    while (result4.next()){
    fcall.addElement(result4.getString("Function_Called"));
    }catch (SQLException e) {System.out.println(e.getMessage());}
    </code>
    So when you get the ID can't you Select the data from the products table that matches it, and then take the Name field for that and search for it in the Company table? I think you can do embedded search statements. another way would be
    Select <blah>
    while(result.next)
    Select <blah>
    hope this helps

  • Sending from one account shows up as another

    I am sure that there is something very simple in the settings that I am missing. My primary email account is a verizon one and it is linked to my Mail on my iMac and MacBook. When I send an email from my iPhone's Verizon account, however, it is received as if it were sent from my gmail account and consequently replies go there. This is not a critical issue, but just bothersome because I use each account for a different purpose and I am ending up forwarding then from one account to the other.
    How do I correct this? It's almost like I set something as a primary account, but I can't find out where that may be.
    Thanks.
    Carole

    Hey all,
    I suspect I'm having a similar problem. For some reason my primary server "smtp.mac.com" won't send messages so the iphone uses my next preferred server "smtp.gmail.com" to send messages. The problem here is that the replies then go to my gmail account (which for me is picked up by my mac and not my iphone).
    This is a big problem for me as I sent an important email today from my iphone and received no reply which (in the context) meant everything was fine. However, I only found out much later in the day whey I got to my computer that in fact everything was not fine and I almost had to cancel meetings to be somewhere the next day all because the apple stuff is just dropping the ball when it comes to actual functionality for business use....
    Anyway, I'm trying to find a solution. If I do I'll post another response. So far I'm looking at ditching mobileme (which is what I currently use as a free trial) and just using gmail and gmail calendar instead.

  • Inserting one table records to the another table

    Hi There
    Though i don't close the Result set , My program throws the following Exception
    java.sql.SQLException: ResultSet is ClosedBecause of this my program Inserts only one record in the another table
    My code is this
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.DefaultComboBoxModel.*;
    import javax.swing.table.*;
    import java.sql.*;
    import java.util.*;
    public class SearchBook extends JDialog implements ActionListener
         private JComboBox comboCategory,comboAuthor;
         private JSplitPane splitpane;
         private JTable table;
         private JToolBar toolBar;
         private JButton btnclose, btncancel;
         private JPanel panel1,panel2,panel3,panel4;
         private JLabel lblCategory,lblAuthor;
         private Container c;
         //DefaultTableModel model;
         Statement st;
         ResultSet rs;
         Vector v = new Vector();
         public SearchBook (Connection con)
              // Property for JDialog
              setTitle("Search Books");
              setLocation(40,110);
              setModal(true);
              setSize(750,450);
              // Creating ToolBar Button
              btnclose = new JButton(new ImageIcon("Images/export.gif"));
              btnclose.addActionListener(this);
              // Creating Tool Bar
              toolBar = new JToolBar();
              toolBar.add(btnclose);
              try
                   st=con.createStatement();
                   rs =st.executeQuery("SELECT BCat from Books Group By Books.BCat");
                   while(rs.next())
                        v.add(rs.getString(1));
              catch(SQLException ex)
                   System.out.println("Error");
              panel1= new JPanel();
              panel1.setLayout(new GridBagLayout());
              GridBagConstraints c = new GridBagConstraints();
              c.fill = GridBagConstraints.HORIZONTAL;
              lblCategory = new JLabel("Category:");
              lblCategory.setHorizontalAlignment (JTextField.CENTER);
              c.gridx=2;
              c.gridy=2;
              panel1.add(lblCategory,c);
              comboCategory = new JComboBox(v);
              comboCategory.addActionListener(this);
              c.ipadx=20;
              c.gridx=3;
              c.gridwidth=1;
              c.gridy=2;
              panel1.add(comboCategory,c);
              lblAuthor = new JLabel("Author/Publisher:");
              c.gridwidth=2;
              c.gridx=1;
              c.gridy=4;
              panel1.add(lblAuthor,c);
              lblAuthor.setHorizontalAlignment (JTextField.LEFT);
              comboAuthor = new JComboBox();
              comboAuthor.addActionListener(this);
              c.insets= new Insets(20,0,0,0);
              c.ipadx=20;
              c.gridx=3;
              c.gridy=4;
              panel1.add(comboAuthor,c);
              comboAuthor.setBounds (125, 165, 175, 25);
              table = new JTable();
              JScrollPane scrollpane = new JScrollPane(table);
              //panel2 = new JPanel();
              //panel2.add(scrollpane);
              splitpane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,panel1,scrollpane);
              splitpane.setDividerSize(15);
              splitpane.setDividerLocation(190);
              getContentPane().add(toolBar,BorderLayout.NORTH);
              getContentPane().add(splitpane);
         public void actionPerformed(ActionEvent ae)
              Object obj= ae.getSource();
              if(obj==comboCategory)
                   String selecteditem = (String)comboCategory.getSelectedItem();
                   displayAuthor(selecteditem);
                   System.out.println("Selected Item"+selecteditem);
              else if(obj==btnclose)
                   dispose();     
              else if(obj==comboAuthor)
                   String selecteditem1 = (String)comboAuthor.getSelectedItem();
                   displayavailablity(selecteditem1);
                   //System.out.println("Selected Item"+selecteditem1);
                   System.out.println("Selected Author"+selecteditem1);
         private void displayAuthor(String selecteditem)
              try
              {     Vector data = new Vector();
                   rs= st.executeQuery("SELECT BAuthorandPublisher FROM Books where BCat='" + selecteditem + "' Group By Books.BAuthorandPublisher");
                   System.out.println("Executing");
                   while(rs.next())
                        data.add(rs.getString(1));
                   //((DefaultComboBoxModel)comboAuthor.getModel()).setVectorData(data);
                   comboAuthor.setModel(new DefaultComboBoxModel(data));
                   //rs.close();
              catch(SQLException ex)
                   System.out.println("ERROR");
         private void displayavailablity(String selecteditem1)
                   try
                        Vector columnNames = new Vector();
                        Vector data1 = new Vector();
                        String bname,bauthor,bcategory,bref1,bavail,bid;
                        int bref,mid,num;
                        rs = st.executeQuery("SELECT * FROM Books where BAuthorandPublisher='" + selecteditem1 +"'");     
                        while(rs.next())
                             bname = rs.getString("BName");                         
                             bauthor = rs.getString("BAuthorandPublisher");
                             bcategory = rs.getString("BCat");
                             bref = rs.getInt("BRef");
                             if(bref==1)bref1="Yes";
                             else bref1 = "No";
                             mid = rs.getInt("Mid");
                             if(mid==0)bavail="Available";
                             else bavail="Issued To:"+mid;
                             bid = rs.getString("BId");
                             System.out.println("Book Name is::"+bname);
                             System.out.println("Book Availabilty::"+bavail);
                             num = st.executeUpdate("insert into BSearch Values('"+bid+"','"+bname+"','"+bcategory+"','"+bauthor+"','"+bavail+"','"+bref1+",')");
                             System.out.println("Inseted in the table");
                        /**ResultSetMetaData md= rs.getMetaData();
                        int columns =md.getColumnCount();
                        String booktblheading[]={"Book ID","Book NAME","BOOK AUTHOR/PUBLISHER","REFRENCE","CATEGORY"};
                        for(int i=1; i<= booktblheading.length;i++)
                             columnNames.addElement(booktblheading[i-1]);
                        while(rs.next())
                             Vector row = new Vector(columns);
                             for(int i=1;i<=columns;i++)
                                  row.addElement(rs.getObject(i));
                             data1.addElement(row);
                             //System.out.println("data is:"+data);
                        ((DefaultTableModel)table.getModel()).setDataVector(data1,columnNames);
                        //DefaultTableModel model = new DefaultTableModel(data1,columnNames);
                        //table.setModel(model);
                        //rs.close();
                        //st.close(); */
                   catch(SQLException ex)
                        ex.printStackTrace();
    }Please help me Friends. I am very new to java. otherwise give me some suggestion to implement this idea in effective manner.
    Thank you for your service
    Cheers

    Hi
    Here i am Posting My programs code
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.DefaultComboBoxModel.*;
    import javax.swing.table.*;
    import java.sql.*;
    import java.util.*;
    public class SearchBook extends JDialog implements ActionListener
         private JComboBox comboCategory,comboAuthor;
         private JSplitPane splitpane;
         private JTable table;
         private JToolBar toolBar;
         private JButton btnclose, btncancel;
         private JPanel panel1,panel2,panel3,panel4;
         private JLabel lblCategory,lblAuthor;
         private Container c;
         //DefaultTableModel model;
         Statement st,st1;
         ResultSet rs,rs1,rs2;
         Vector v = new Vector();
         public SearchBook (Connection con)
              // Property for JDialog
              setTitle("Search Books");
              setLocation(40,110);
              setModal(true);
              setSize(750,450);
              // Creating ToolBar Button
              btnclose = new JButton(new ImageIcon("Images/export.gif"));
              btnclose.addActionListener(this);
              // Creating Tool Bar
              toolBar = new JToolBar();
              toolBar.add(btnclose);
              try
                   st=con.createStatement();
                   rs =st.executeQuery("SELECT BCat from Books Group By Books.BCat");
                   while(rs.next())
                        v.add(rs.getString(1));
              catch(SQLException ex)
                   System.out.println("Error");
              panel1= new JPanel();
              panel1.setLayout(new GridBagLayout());
              GridBagConstraints c = new GridBagConstraints();
              c.fill = GridBagConstraints.HORIZONTAL;
              lblCategory = new JLabel("Category:");
              lblCategory.setHorizontalAlignment (JTextField.CENTER);
              c.gridx=2;
              c.gridy=2;
              panel1.add(lblCategory,c);
              comboCategory = new JComboBox(v);
              comboCategory.addActionListener(this);
              c.ipadx=20;
              c.gridx=3;
              c.gridwidth=1;
              c.gridy=2;
              panel1.add(comboCategory,c);
              lblAuthor = new JLabel("Author/Publisher:");
              c.gridwidth=2;
              c.gridx=1;
              c.gridy=4;
              panel1.add(lblAuthor,c);
              lblAuthor.setHorizontalAlignment (JTextField.LEFT);
              comboAuthor = new JComboBox();
              comboAuthor.addActionListener(this);
              c.insets= new Insets(20,0,0,0);
              c.ipadx=20;
              c.gridx=3;
              c.gridy=4;
              panel1.add(comboAuthor,c);
              comboAuthor.setBounds (125, 165, 175, 25);
              table = new JTable();
              JScrollPane scrollpane = new JScrollPane(table);
              //panel2 = new JPanel();
              //panel2.add(scrollpane);
              splitpane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,panel1,scrollpane);
              splitpane.setDividerSize(15);
              splitpane.setDividerLocation(190);
              getContentPane().add(toolBar,BorderLayout.NORTH);
              getContentPane().add(splitpane);
         public void actionPerformed(ActionEvent ae)
              Object obj= ae.getSource();
              if(obj==comboCategory)
                   String selecteditem = (String)comboCategory.getSelectedItem();
                   displayAuthor(selecteditem);
                   System.out.println("Selected Item"+selecteditem);
              else if(obj==btnclose)
                   dispose();     
              else if(obj==comboAuthor)
                   String selecteditem1 = (String)comboAuthor.getSelectedItem();
                   displayavailablity(selecteditem1);
                   //System.out.println("Selected Item"+selecteditem1);
                   System.out.println("Selected Author"+selecteditem1);
         private void displayAuthor(String selecteditem)
              try
              {     Vector data = new Vector();
                   rs1= st.executeQuery("SELECT BAuthorandPublisher FROM Books where BCat='" + selecteditem + "' Group By Books.BAuthorandPublisher");
                   System.out.println("Executing");
                   while(rs1.next())
                        data.add(rs1.getString(1));
                   //((DefaultComboBoxModel)comboAuthor.getModel()).setVectorData(data);
                   comboAuthor.setModel(new DefaultComboBoxModel(data));
              catch(SQLException ex)
                   System.out.println("ERROR");
         private void displayavailablity(String selecteditem1)
                   try
                        Vector columnNames = new Vector();
                        Vector data1 = new Vector();
                        String bname,bauthor,bcategory,bref1,bavail,bid;
                        int bref,mid,num;
                        //rs2.Open();
                        rs = st.executeQuery("SELECT * FROM Books where BAuthorandPublisher='" + selecteditem1 +"'");     
                        boolean tr=true;
                        while(rs.next())
                             if(true)
                                  bname = rs.getString("BName");                         
                                  bauthor = rs.getString("BAuthorandPublisher");
                                  bcategory = rs.getString("BCat");
                                  bref = rs.getInt("BRef");
                                  if(bref==1)bref1="Yes";
                                  else bref1 = "No";
                                  mid = rs.getInt("Mid");
                                  if(mid==0)bavail="Available";
                                  else bavail="Issued To:"+mid;
                                  bid = rs.getString("BId");
                                  System.out.println("Book Name is::"+bname);
                                  System.out.println("Book Availabilty::"+bavail);
                             num = st1.executeUpdate("insert into BSearch Values('"+bid+"','"+bname+"','"+bcategory+"','"+bauthor+"','"+bavail+"','"+bref1+",')");
                             System.out.println("Inseted in the table");
                   catch(SQLException ex)
                        ex.printStackTrace();
    }Thank you for your service

  • Search one column for value in another column

    Hello,
    I am trying to take the whole value from one column, and see if that string appears anywhere in another colmn. So if one row in one column has the value "cat", I want to see if that string appears anywhere in any row in another column: so a row with the value "The cat sat on the mat" would return true.
    I have tried:
    select term from pic_lib_keywords, csv
    where contains (csv.nhm_field_asset_description,pic_lib_keywords.term) >0;
    But I get the error:
    ORA-20000: Oracle Text error:
    DRG-50901: text query parser syntax error on line 1, column 32
    20000. 00000 - "%s"
    *Cause:    The stored procedure 'raise_application_error'
    was called which causes this error to be generated.
    *Action:   Correct the problem as described in the error message or contact
    the application administrator or DBA for more information.
    Can you use 2 columns in this way, or does the search term have to be a literal? Any suggestions would be appreciated.
    Thank you.

    It works for me, as shown below.
    SCOTT@orcl_11gR2> select * from v$version
      2  /
    BANNER
    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
    PL/SQL Release 11.2.0.1.0 - Production
    CORE     11.2.0.1.0     Production
    TNS for 64-bit Windows: Version 11.2.0.1.0 - Production
    NLSRTL Version 11.2.0.1.0 - Production
    5 rows selected.
    SCOTT@orcl_11gR2> create table csv
      2    (nhm_field_asset_description  clob)
      3  /
    Table created.
    SCOTT@orcl_11gR2> insert all
      2  into csv values ('The cat sat on the mat.')
      3  into csv values ('The dog sat on the mat.')
      4  select * from dual
      5  /
    2 rows created.
    SCOTT@orcl_11gR2> create table pic_lib_keywords
      2    (term  varchar2(30))
      3  /
    Table created.
    SCOTT@orcl_11gR2> insert all
      2  into pic_lib_keywords values ('cat')
      3  into pic_lib_keywords values ('mouse')
      4  select * from dual
      5  /
    2 rows created.
    SCOTT@orcl_11gR2> create index test_idx
      2  on csv (nhm_field_asset_description)
      3  indextype is ctxsys.context
      4  /
    Index created.
    SCOTT@orcl_11gR2> select term
      2  from   pic_lib_keywords, csv
      3  where  contains
      4             (csv.nhm_field_asset_description,
      5              pic_lib_keywords.term) >0
      6  /
    TERM
    cat
    1 row selected.
    SCOTT@orcl_11gR2>

  • HT3354 how can i use one table for reference to another

    how can i use a table for a referance to another eg when i type a word in a cell, i will like it to match the word with another table then return the information in the cell i am using

    you can use vlookup() (or any of the lookup family of functions) to locate an item based on a key value:
    Here is an example of something you can do with two tables:
    The table on the right is title "Data" and stores a list of names with age and favorite color.
    The table on the left uses the value in the first column to lookup up information in the table Data
    in the table on the left:
    B2=IFERROR(A2&" is " & VLOOKUP(A2, Data :: A:D, 2, 0)&" years old and likes the color "& VLOOKUP(A2, Data :: A:D, 3, 0), "NOT FOUND")
    I know this look complicated.  so I'll break it up into smalled pieces:
    first the "&" is called the concatenate operator and joins two strings.  like this:
    a string is a set of characters between double quotes.
    so "string 1" & "string 2" becomes "string 1string2"  or "Sam " & "Jones" becomes "Sam Jones"
    you can use cell references instead of strings directly in which case the concatenation is performed on the contents of the cells.
    so if cell A1 contains "Hi " and the cell A2 contains "There"  then A1 & A2 will result in "Hi There"
    so you could add the formula
    A3=A1 & A2
    this is short hand for select cell A3 then type everything including the A3 so that A3 contains "=A1 & A2" (omit the double quote)
    OK.  So the formula I provided concatenates several items together:
    it concatenates A2, then the string " is " then a formula, then the string " years old and likes the color " then a formula
    the two formulas (highlighted in blue) perform a lookup of the value in cell A2 in columns A thru D of the table named "Data".  If if finds the value in cell A2 in the first column of the lookup range in the table Data (column A) then it returns the value from the same row but in the second or third column.
    all that is in a function calld iserror() to trap the condition where the calue you enter in A2 does not exist in the table Data:
    You will find the Numbers users guide and function reference helpful.  You can download then from Apple here:
    http://support.apple.com/manuals/#productivitysoftware

Maybe you are looking for

  • Conversion from AI to Visio

    So far, all my attempts to convert AI drawings to Visio look more like a pixel import than a direct vector-to-vector translation. More precisely, they look like a bunch of pixel groups for each line segment, probably at screen resolution. Unfortunate

  • How can I change my current icloud email? i still want an icloud email but under a new address name

    i still want an icloud email but under a new address name. I simply want a new email address under icloud but keep my same account. is this possible??? how can i do this??

  • Control numerico meter(silv​er)

    saludos al foro... es posible que a un control numerico meter (silver) pueda configurarlo para que pueda visualizar una escala de 0 a 100 pero que controle en una escala de 0 a 250. es decir quiero que el usuario solo visualice 0-100 pero que realmen

  • 6220 classic

    Just got a 6220 classic - tried connecting with my pc - dont think that really worked. Anyway my phone is now frozen and I cannot switch it on. What can I do ?

  • Patch deployment via Zen works

    what is the best way to do this for a few houndred workstaions? a step by step way thanks