Retrieve data from database in swing application
I want to retrive data(doctor name,specilization,date) from my sql database.
............................................................................
doctors name(JLabel1) jtextfield1
specialization(JLabel2) jtextfield2
date(Jlabel3) jtextfield3
jbutton
...........................................................................
in above i show the gui of the programme wrote using netbeans desktop applications.i want to show related fields in another jframe.please send the code to me????
View Answers
February 6, 2012 at 1:11 PM
import java.awt.*;
import java.sql.*;
import javax.swing.*;
import java.awt.event.*;
class FormDemo
{
public static void main(String[]args){
JFrame f=new JFrame();
JPanel panel;
JLabel label1,label2;
final JTextField text1,text2;
label1 = new JLabel();
label1.setText("Name:");
text1 = new JTextField(20);
label2 = new JLabel();
label2.setText("Address:");
text2 = new JTextField(20);
panel=new JPanel(new GridLayout(2,2));
panel.add(label1);
panel.add(text1);
panel.add(label2);
panel.add(text2);
f.add(panel);
try{
Class.forName("com.mysql.jdbc.Driver").newInstance();
Connection conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/test", "root", "root" );
Statement st=conn.createStatement();
ResultSet rs=st.executeQuery("select * from data where id=1");
while(rs.next()){
text1.setText(rs.getString("name"));
text2.setText(rs.getString("address"));
}
}
catch(Exception e){}
f.pack();
f.setVisible(true);
}
}
Ads
Related Tutorials/Questions & Answers:
Retrieve data from database in swing application
Retrieve data from database in
swing application I want to retrive
data(doctor name,specilization,date)
from my sql
database...();
ResultSet rs=st.executeQuery("select *
from data where id=1");
while
Advertisements
retrieve data from database with hyperlink
retrieve data from database with hyperlink sir....i have one table called 'name' having two values i have to
retrieve those
data with a hyperlink... have values
C
C++
i have to
retrieve and if i click C its sub categories should
Retrieve multiple data from database into Table.....
Retrieve multiple
data from database into Table..... hi...........
I want to
Retrieve multiple
data from database into Table but i am not able to....
i am only able to
retrieve one value not more than that. means
in my
retrieve data from mysql database
retrieve data from mysql database hi am not familiar in php.....even... selected value on combobox which is to be
retrieve the relevant
data from mysql
database using php.... below my code is that..
<html>
<head>
Data retrieve from mysql database
Data retrieve from mysql database Hi sir,
please give some example of jsp code for retrieving mysql
database values in multiple dropdown list...
from the dropdown, related
data will get displayed on the textboxes. Here we have
retrieve data from database using jsf
retrieve data from database using jsf Hello
I want an example of source code to
retrieve data from database
i have a
database (oracle) name as db1...),, name ,and city
I want after enter value in textbox according idauthor i
retrieve
retrieve related data from database using jsp and mysql
retrieve related
data from database using jsp and mysql Hi sir,
please give some example of jsp code for retrieving mysql
database values in multiple dropdown list. if we change a value in a dropdown its related value must
Application reading data from JDBC database
Application reading
data from JDBC database I would like to develop..." should read
data from from a JDBC
database named PrimeGame with TABLE PRIMEGAMETABLE... for a Prime Game competition. The
application has two links namely "register
retrieve from database........
retrieve from database........ <p>hi i am not able to
retrieve string
from database to a text box in web page my code is as follows:-</p>...("username");
re=stmt.executeQuery("select *
from userreg where username='"+username
How to retrieve image from database
How to
retrieve image
from database hi........
How to
retrieve image
from database when it is stored.
I have stored image in postgresql and want to
retrieve in java form.
Can u tel me hw to do?
I am trying n able to do also
Display Data from Database in JSF Application
Display
Data from Database in JSF
Application
 ...
data
from database in JSF
application.
Developing JSF
Application
In this section, we are going to display
data from database in JSF based web
How to retrieve image from mysql database in JSP?
How to
retrieve image
from mysql
database in JSP? Hi,
I need JSP... to
retrieve image
from mysql
database in JSP?
Thanks
Hi,
You can write SQL query to find the
data from database and get the image
from resultset using
Select data from Table in Database
the selected
data from table in
database. The
select query in the
database retrieve... Select
data from Table in
Database
 ... to
retrieve the
data from table. In
this Tutorial we create a table country
How to Retrieve data from database in jsp
How to
Retrieve data from database in jsp
In this section we will discuss... are going to discus about
retrieve data from database in jsp.First of all
we have... is the video tutorial of "How to
retrieve data from database and Display in JSP Page
How to retrieve blob image from database in JSP?
How to
retrieve blob image
from database in JSP? Hello,
JSP is used... the blog image
from database.
How to
retrieve blob image
from database in JSP?
Hi,
Please check the tutorial
Retrieve image
from database using
How to store and retrieve image from database in JSP?
How to store and
retrieve image
from database in JSP? Hi,
In one... and
retrieve image
from database in JSP?
Thanks
HI,
You can use... the image. Check this example:
Retrieve image
from database using Servlet.
Thanks