Results 1 to 6 of 6

Thread: Retrieve selected Data From a Table

  1. #1
    Join Date
    Nov 2009
    Posts
    678

    Retrieve selected Data From a Table

    Hello, I am searching for the program which can help me to retrieve the data from the table with the help of java programming. I have tried it, but I am getting error while doing it, if anyone is having some or the other information while working on it or if you are having any code to help me then please reply me about it.

  2. #2
    Join Date
    May 2008
    Posts
    2,389

    Re: Retrieve selected Data From a Table

    Hey, same problem here, while retrieving selected data from the table I was also getting problem. I have code below for it:
    <display: table id ="Loan" name ="$ () contexteSession.listePret" pagesize ="20" requestURI ="choixpret.do" summary ="Ready list">
    Code:
    <display:column>
    <html: radio property ="pretSelected" value ="$ () pret.numero"/>
    </ display: column>
    <display: column property ="numero" title ="Number />
    <display: column property ="type" title ="Type"/>
    <display: column property ="state" title ="State />
    <display: column property ="nominal" title ="Nominal"/>
    </ display: table>
    Code:
    List <Pret> listePret = ListePretService.recupererListePret(context,
    user fctRecherche, choixClientForm);
    ContexteSessionUtil.GetContexteSession(request.getSession()).setListePret(listePret);
    If anyone is having solution on it then please help me.

  3. #3
    Join Date
    Feb 2008
    Posts
    1,852

    Re: Retrieve selected Data From a Table

    Hello, I am making use of the code below for retrieving selected data from a list:
    Code:
    <% Int idx = 0;%>
    <display: table id ="Loan" name ="$ () contexteSession.listePret" pagesize ="20" requestURI ="choixpret.do" summary ="Ready list">
       <display:column>
         <html: radio property ="pretSelected" value ="<% = i ++%>"/>
       </ display: column>

  4. #4
    Join Date
    Jan 2008
    Posts
    1,521

    Re: Retrieve selected Data From a Table

    To Retrieve selected Data From a Table you need to make use of the jdbc code below:
    Code:
    import java.sql.*;
    public class Testdemo
    {
            public static void main(String[] args) 
    {
                     String url = " jdbc:odbc:test ";
             try 
    {
                Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
                Connection con = DriverManager.getConnection("jdbc:odbc:test"; "", "");
                Statement statement = con.createStatement();
                ResultSet rs = statement.execute("select ename,job from emp");
                while(rs.next())
    {
                          System.out.println(rs.getString(1));
                          System.out.println(rs.getString(2));
    }      
        catch( Exception e ) 
    {
          e.printStackTrace();        
    }
    }
    }

  5. #5
    Join Date
    Apr 2008
    Posts
    1,948

    Re: Retrieve selected Data From a Table

    If you are making use of the java the you need to make use of the execute() method. This execute() method of the Statement object can help you to get the data from a table. For creating this code you need to create first JDBC connection with the database and then need to get the all of the records from the table or records which you want. For that use of the ResultSet object is done. So, that afterword all the content from the ResultSet is printed to the console.

  6. #6
    Join Date
    May 2008
    Posts
    2,012

    Re: Retrieve selected Data From a Table

    If you want to select the single row from the table then you need to make use of the following code:
    Code:
    String rollno = rollNumber.getText();
    try 
    {
      PreparedStatement pstmt;
      boolean got = false;
      pstmt = theConn.prepareStatement("select custName, CustAddr from tCust where rollNum = ?");
      pstmt.setString(1, rollno);       
      ResultSet rs;
      rs = pstmt.executeQuery();      
      got = rs.next();
      if (got)
          System.out.println(rs.getString(1));
      else
          System.out.println("Customer " + rollno + " not got!");
       pstmt.close();
       }
    catch (Exception e) 
    {
       e.printStackTrace();
    }

Similar Threads

  1. Extracting Selected Data from a txt file
    By sidney786 in forum Software Development
    Replies: 3
    Last Post: 20-08-2010, 01:07 AM
  2. Replies: 3
    Last Post: 19-07-2010, 04:23 PM
  3. How to copy one table data into another table directly?
    By ComPaCt in forum Software Development
    Replies: 3
    Last Post: 22-09-2009, 03:54 PM
  4. How to retrieve XML data & display on the page in the table?
    By VijayW in forum Software Development
    Replies: 2
    Last Post: 16-02-2009, 09:56 PM
  5. Getting data from a selected row in gridview in VB.Net
    By Booth in forum Software Development
    Replies: 2
    Last Post: 15-01-2009, 10:39 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,711,701,480.37654 seconds with 17 queries