Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa JDBC awt jdbc

Have Programming Question? Ask it here!
 
 
 


dhanashree darshale
awt jdbc
1 Answer(s)      3 years and 5 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


Advertisement
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 Tutorials/Questions & Answers:
AWT
AWT  How to set size of button in awt
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
Advertisements
Java AWT
Java AWT  What interface is extended by AWT event listeners
jdbc - JDBC
Why JDBC   JDBC used for what
JAVA AWT BASE PROJECT
JAVA AWT BASE PROJECT  suggest meaningful java AWT-base project
jdbc - JDBC
Java JDBC application  Database Application in Java JDBC
JDBC - JDBC
JDBC Select Count Example   Need an example of count in 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
Java AWT event hierarchy
Java AWT event hierarchy  What class is the top of the AWT event hierarchy?  The java.awt.AWTEvent class is the highest-level class in the AWT event-class hierarchy
jdbc - JDBC
JDBC statement example in java  Can anyone explain me ..what is statement in JDBC with an example
AWT basics
AWT basics Are you looking for the AWT Basics to help you learn AWT quickly? Here we have provided you the links to our AWT tutorials. AWT stands.... Now a day?s developers are using Swing components instead of AWT to develop
jdbc - JDBC
JDBC Query to Connect Database  JDBC Query to connect to database  will u supply me the block of code where it throws the exception
awt - Java Interview Questions
awt  what is the difference between awt and swings  Hi friend, These are basically the main differences between awt and swing. 1.swing components sits on the top of AWT components and do the wiork. 2.AWT
awt list item* - Swing AWT
awt list item*  how do i make an item inside my listitem not visible  Hi friend, import java.awt.*; import java.awt.event.... information. http://www.roseindia.net/java/example/java/awt/ Thanks
jdbc - JDBC
jdbc  Hi, Could you please tell me ,How can we connect to Sql server through JDBC. Which driver i need to download. Thank You   Hi Friend, Please visit the following code: http://www.roseindia.net/jdbc
JDBC - JDBC
JDBC  DEAR SIR, HOW TO RUN JDBC PROGRAMS AND TELL ME HOW SET ENVIRONMENTAL PATH IN CONTROL PANNEL.....   Hi Friend, Please visit the following link: http://www.roseindia.net/jdbc/jdbc.shtml Thanks
JDBC - JDBC
JDBC  i am goint to work on JDBC and i knew oracle but very poor in java is it possoble to me to do JDBC is it so please give me SOME SAMPLE ILLUSTRATIONS to understand the way to do work in JDBC with syntaxes  Hi
query - Swing AWT
java swing awt thread query  Hi, I am just looking for a simple example of Java Swing
JDBC - JDBC
String url = "jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ=D... on JDBC visit to : http://www.roseindia.net/jdbc/ Thanks
jdbc - JDBC
drivers for concurrent access?   Question: Is the JDBC-ODBC Bridge multi-threaded? Answer: No. The JDBC-ODBC Bridge does not support concurrent access from different threads. The JDBC-ODBC Bridge uses synchronized methods
jdbc - JDBC
in JSP to create a table. 2)how desc can be written in JDBC concepts  ... = null; String url = "jdbc:mysql://localhost:3306/"; String db... information on JDBC-Mysql visit to : http://www.roseindia.net/jdbc/jdbc-mysql
AWT code for popUpmenu - Swing AWT
AWT code for popUpmenu  Respected Sir/Madam, I am writing a program in JAVA/AWT.My requirement is, a Form consists of a "TextBox" and a "Button... for more information. http://www.roseindia.net/java/example/java/awt/pop
JDBC - JDBC
implementing class.  Hi friend, Example of JDBC Connection with Statement... database table!"); Connection con = null; String url = "jdbc:mysql...){ e.printStackTrace(); } } } For more information on JDBC visit to : http
jdbc - JDBC
conn = null; String url = "jdbc:mysql://localhost:3306/"; String dbName.../jdbc/ Thanks
JDBC - JDBC
JDBC  how can i do jdbc through oracle.. pls if u can send me d.... thanking u santosh.  Hi Friend, Use JDBC with Oracle Follow...) Load and Register the JDBC driver:*********** DriverManager.registerDriver(new
jdbc - JDBC
jdbc   kindly give the example program for connecting oracle dase...*; import oracle.jdbc.driver.*; import oracle.sql.*; 2) Load and Register the JDBC...,you have to use: Connection conn = DriverManager.getConnection("jdbc:oracle
JDBC - JDBC
"); con = DriverManager.getConnection("jdbc:mysql://192.168.10.211...://www.roseindia.net/jdbc
jdbc - JDBC
information. http://www.roseindia.net/jdbc/ http://www.roseindia.net/jsp
JDBC - JDBC
JDBC connection to database and show results  Check if the database connectivity is working fine and show results. Also through an exception...("oracle.jdbc.driver.OracleDriver"); conn = DriverManager.getConnection("jdbc:oracle:thin
jdbc - JDBC
= null; String url = "jdbc:mysql://localhost:3306/"; String dbName.... http://www.roseindia.net/jdbc/ Thanks
jdbc - JDBC
: http://www.roseindia.net/jdbc/save_image.shtml Retrieve Image using Java... = DriverManager.getConnection( "jdbc:mysql://localhost:3306/test", "root", "root
jdbc - JDBC
main(String[]args){ try{ Connection con = null; String url = "jdbc:mysql...(); Connection con = DriverManager.getConnection( "jdbc:mysql://localhost:3306/test...://www.roseindia.net/jdbc/ Thanks
jdbc - JDBC
("com.mysql.jdbc.Driver"); Connection con=DriverManager.getConnection("jdbc:mysql://localhost... con=DriverManager.getConnection("jdbc:mysql://localhost:3306/ram","root","root...(Exception l) { d.println(l); } } } For any more problem on JDBC
jdbc - JDBC
Example!"); Connection con = null; String url = "jdbc:mysql://localhost...; String url = "jdbc:mysql://192.168.10.211:3306/amar"; String driver...(); } } } --------------------------------------------- Visit for more information: http://www.roseindia.net/jdbc
AWT
jdbc - JDBC
jdbc  Hi.. i am running the servlet program with jdbc connections in this porgram i used two 'esultset' objects.. in this wat ever coding is available in the first resultset is executed like updating and retrieiving
jdbc - JDBC
conn = null; String url = "jdbc:mysql://localhost:3306/"; String dbName
jdbc - JDBC
("jdbc:mysql://localhost:3306/ram","root","root"); System.out.println("Connect... information. http://www.roseindia.net/jdbc/ Thanks
jdbc - JDBC
jdbc  jdbc Expert:Ramakrishna Statement st1=con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE); ResultSet rs10... Deletion Example"); Connection con = null; String url = "jdbc:mysql://localhost
Swing and AWT Problem - Swing AWT
Swing and AWT Problem  hi sir i have a problem i know from one Jframe we can send values to another Jframe. so in my project i have one fame containing three textfields CODE: String a=TNa.getText().toString(); String b
SWINGS - Swing AWT
more information,Examples and Tutorials on Swing,AWT visit to : http://www.roseindia.net/java/example/java/awt/ http://www.roseindia.net/java/example/java
Window State - Swing AWT
Window State  Thanks for you reply. I have already tried the setSize() method of AWT Window and also with JFrame. But I want to Maximize the Window when it is opened by the user and instead of the Maximize
JDBC in JSP - JDBC
JDBC in JSP   Sir, This is the code showing the problem. regards sreejith
JDBC in JSP - JDBC
JDBC in JSP   Sir, This is the code showing the problem. regards sreejith
What is JDBC?
What is JDBC?  What is JDBC
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
java - Swing AWT
java  i want a program that accepts string from user in textfield1 and prints same string in textfield2 in awt   hi, import java.awt.... information, http://www.roseindia.net/java/example/java/awt/ Thanks
Query On JDBC - JDBC
Query On JDBC  Hello , I am trying to migrate from xls TO mysql in Linux platform.. I'm using JDBC ODBC Bridge Driver..String url = "jdbc:excel:./personal1.xls";System.out.println
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
Alternative for jdbc - JDBC
Alternative for jdbc  Is jdbc the standard for use in J2EE arct.. Which other method is available for database connectivity in J2EE
Advertisements
 

 

 

DMCA.com