Home Answers Viewqa JDBC awt jdbc

 
 


dhanashree darshale
awt jdbc
1 Answer(s)      2 years and 2 months ago
Posted in : JDBC

programm in java to accept the details of doctor (dno,dname,salary)user & insert it into the database(use prerparedstatement class&awt

View Answers

March 16, 2011 at 3:02 PM


import java.awt.*;
import java.sql.*;
import javax.swing.*;
import java.awt.event.*;
class  FormData{

    public static void main(String[] args){
    Frame f=new Frame();
    Label label1=new Label("D No: ");
    Label label2=new Label("D Name: ");
    Label label3=new Label("Salary: ");
    final TextField text1=new TextField(20);
    final TextField text2=new TextField(20);
    final TextField text3=new TextField(20);
    Button b=new Button("Save");
    b.addActionListener(new ActionListener(){
        public void actionPerformed(ActionEvent e){
        int v1=Integer.parseInt(text1.getText());
        String v2=text2.getText();
        int v3=Integer.parseInt(text3.getText());

        try{
           Class.forName("com.mysql.jdbc.Driver");
           Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/test", "root", "root");
           String sql = "insert into doctor(dno,dname,salary) values(?,?,?) ";
            PreparedStatement pst = con.prepareStatement(sql);

            pst.setInt(1, v1);
            pst.setString(2, v2);
            pst.setInt(3,v3);
            pst.executeUpdate();
           JOptionPane.showMessageDialog(null,"Data is inserted successfully");
        }
        catch(Exception ex){
            System.out.println(ex);
        }
        }
    });
        Panel p=new Panel(new GridLayout(5,2));
        p.add(label1);
        p.add(text1);
        p.add(label2);
        p.add(text2);
        p.add(label3);
        p.add(text3);
        p.add(b);
        f.add(p);
        f.setVisible(true);
        f.pack();
    }
}









Related Pages:
awt
JDBC in awt applet  how to display data using JDBC in awt/applet
awt
JDBC and AWT to display data  how to display data using JDBC in awt/applet
awt
JDBC in awt  how to display data using JDBC in awt/applet
awt
Java AWT Applet example  how to display data using JDBC in awt/applet
awt jdbc
awt jdbc  programm in java to accept the details of doctor (dno,dname,salary)user & insert it into the database(use prerparedstatement class&awt
JDBC-AWT
JDBC-AWT  I can not able to capture the data in an applet which contains the components like text fields,check box etc.. and i am trying to save the data in sql+. When i run the code in netbeans, i can abe to store successfully
swing with jdbc - Swing AWT
have some problems with swing using jdbc. 1. the values entered in table are not stored in DB. 2. is there is any solution that uses jtable with JDBC? kindly... =DriverManager.getConnection("jdbc:odbc:access"); pstm=connect.prepareStatement("insert into data
jdbc
jdbc  write a java program to accept the details of employee(eno,ename,sal)from the user and insert into the database(use awt
how to implements jdbc connections using awt
valuable information about how to implements jdbc connections in awt.please give me sample example awt with jdbc. Thanking you sir.  ...how to implements jdbc connections using awt  sir, My name
how to implements jdbc connections using awt?
how to implements jdbc connections using awt?   My name is Aditya... information about how to implements jdbc connections in awt.please give me sample example awt with jdbc.   We are proving you a simple application
AWT
AWT  How to set size of button in awt
java - Swing AWT
java  how can i add items to combobox at runtime from jdbc   Hi Friend, Please visit the following link: http://www.roseindia.net..."); Connection conn = DriverManager.getConnection("jdbc:odbc:access
java swing - Swing AWT
("com.mysql.jdbc.Driver"); Connection connect =DriverManager.getConnection("jdbc:mysql
Date - Swing AWT
,month,year into MS-Access using JDBC. 3.it should be in Format DD-MM-YY... = DriverManager.getConnection("jdbc:odbc:access"); PreparedStatement pstmt
java - Swing AWT
= null; String url = "jdbc:mysql://localhost:3306/"; String db = "test...(); String value6=text5.getText(); Connection con = null; String url = "jdbc
Java question - Swing AWT
= DriverManager.getConnection("jdbc:mysql://localhost:3306/register", "root", "root
Java Program - Swing AWT
= DriverManager.getConnection("jdbc:mysql://localhost:3306/test", "root", "root
AWT
Need source code - Swing AWT
=DriverManager.getConnection("jdbc:odbc:access"); String sql = "Select * from
Need source code - Swing AWT
actionPerformed(ActionEvent e){ try{ Connection con = null; String url = "jdbc:mysql... = DriverManager.getConnection( "jdbc:mysql://localhost:3306/test", "root
java - JDBC
numbrer in msaccess and make a text boxes in awt takes the above mentioned two...; String url = "jdbc:mysql://192.168.10.211:3306/"; String db = "amar.../example/java/awt/ Thanks. Amardeep
add button to the frame - Swing AWT
) DriverManager.getConnection("jdbc:mysql://localhost/lab", "root", "root..."); Connection con = (Connection) DriverManager.getConnection("jdbc:mysql
java to excel connectivity - Swing AWT
" ); Connection c = DriverManager.getConnection( "jdbc:odbc:Driver
retrieve data into textbox - Swing AWT
"); Connection con =DriverManager.getConnection("jdbc:odbc:Mydatasource
Java swing in NetBeans - Swing AWT
=DriverManager.getConnection("jdbc:odbc:Stu","admin","admin"); try... = DriverManager.getConnection("jdbc:mysql://localhost:3306/test","root", "root
focus text field - Swing AWT
) DriverManager.getConnection("jdbc:mysql://localhost/lab", "root", "root"); PreparedStatement...("com.mysql.jdbc.Driver"); Connection con = (Connection) DriverManager.getConnection("jdbc
focus text field - Swing AWT
) DriverManager.getConnection("jdbc:mysql://localhost/lab", "root", "root"); PreparedStatement
AWT & SWING
AWT & SWING  What is diffennce between AWT & SWING
AWT programmes - Swing AWT
AWT programmes  I need few programs for menus in AWT. how to open a filed dialog window, and how to save a image in the save window when we press... has all AWT programms which must open,save and make changes to a particular
JDBC Tutorial, JDBC API Tutorials
to use JDBC API effectively to develop database driven applications in Java. You can use JDBC in your console, AWT, Swing and Web applications. JDBC API provides...Java Database Connectivity(JDBC) Tutorial This tutorial on JDBC explains you
awt in java
awt in java  using awt in java gui programming how to false the maximization property of a frame
regarding java - JDBC
done front end work using swing and AWT concepts of java i am using mysql... this or tell me if there is another way out    Hi friend, Use JDBC i... contact: http://www.roseindia.net/jdbc/ Thanks
Java AWT
Java AWT  What interface is extended by AWT event listeners
fetch data from ms acces - Swing AWT
= DriverManager.getConnection("jdbc:odbc:access"); Statement st=con.createStatement
java to MS Access conectivity - Swing AWT
("sun.jdbc.odbc.JdbcOdbcDriver"); Connection connect =DriverManager.getConnection("jdbc:odbc:access
binding jComboBox to mysql database - Swing AWT
= null; String url = "jdbc:mysql://localhost:3306/"; String db
how to retrive other details with an image - Swing AWT
(); Connection conn = DriverManager.getConnection("jdbc:odbc
awt - Swing AWT
awt  dear sir my proble is , i have applet code which is stock market chart this code made using "AWT" . in this chart one textbox when user.../java/awt/ Thanks
Java AWT
Java AWT  What is meant by controls and what are different types of controls in AWT
How to put the logo in login form using swings/awt?
How to put the logo in login form using swings/awt?  Hi, How to put the logo in login form using swings/awt? I write the login form is working...("com.mysql.jdbc.Driver"); Connection con = DriverManager.getConnection("jdbc
awt swings - Swing AWT
awt swings  hello sir, My requirement is to insert captured image from cam onto a frame and from that place i hve to save it in the database(MySql).its urgent sir.it is a part of my project..if code is available
JDBC
JDBC  why we use batch in jdbc
jdbc
jdbc  display the records using index in jdbc
jdbc
jdbc  Hai , Give a steps for jdbc connectivity
JDBC
JDBC  How to add set of queries in a single query in JDBC
jdbc
jdbc  please tell me sir.i dont know JDBC connection and how to create table in database
JDBC
JDBC  how to set classpath for eclipse, java, where to copy jdbc connector

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.