Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Register Tags Active Topics RSS Search Mark Forums Read

Sponsored Links



Retrieve selected Data From a Table

Software Development


Reply
 
Thread Tools Search this Thread
  #1  
Old 30-01-2010
Member
 
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.

Reply With Quote
  #2  
Old 30-01-2010
Member
 
Join Date: May 2008
Posts: 2,377
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.
Reply With Quote
  #3  
Old 30-01-2010
Member
 
Join Date: Feb 2008
Posts: 1,843
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>
Reply With Quote
  #4  
Old 30-01-2010
Member
 
Join Date: Jan 2008
Posts: 1,512
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();        
}
}
}
Reply With Quote
  #5  
Old 30-01-2010
Member
 
Join Date: Apr 2008
Posts: 1,946
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.
Reply With Quote
  #6  
Old 30-01-2010
Member
 
Join Date: May 2008
Posts: 2,004
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();
}
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Retrieve selected Data From a Table"
Thread Thread Starter Forum Replies Last Post
Extracting Selected Data from a txt file sidney786 Software Development 3 20-08-2010 01:07 AM
PHP - I want to retrieve records from specific field from a MySQL table and build array using PHP bond007dev Software Development 3 19-07-2010 04:23 PM
How to copy one table data into another table directly? ComPaCt Software Development 3 22-09-2009 03:54 PM
How to retrieve XML data & display on the page in the table? VijayW Software Development 2 16-02-2009 08:56 PM
Getting data from a selected row in gridview in VB.Net Booth Software Development 2 15-01-2009 09:39 PM


All times are GMT +5.5. The time now is 07:03 PM.