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



Home Answers Viewqa JDBC how to connect program to database
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


Priya Durge
how to connect program to database
0 Answer(s)      3 years and 9 months ago
Posted in : JDBC


Sir i want ur help in my program. I want to save the data in the database. When i'll click on save button the entered data must be save in the database. I want an action performed method for this.

import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.sql.*; public class New_Cust extends JFrame implements ActionListener { JLabel l1,l2,l3,l4,l5,l6; JTextField tf1,tf2,tf3,tf4,tf5,tf6; JButton b1,b2; JPanel p; JFrame f;

New_Cust()
{
    l1 = new JLabel("Customer Name");
    tf1 = new JTextField(5);

    l2 = new JLabel("Alias Name");
    tf2 = new JTextField(5);

    l3 = new JLabel("Address");
    tf3 = new JTextField(5);

    l4 = new JLabel("Phone No.");
    tf4 = new JTextField(5);

    l5 = new JLabel("Mobile No.");
    tf5 = new JTextField(5);

    l6 = new JLabel("E-Mail");
    tf6 = new JTextField(5);

    b1 = new JButton("SAVE");
    b1.setBackground(Color.GRAY);
    b2 = new JButton("CANCEL");
    b2.setBackground(Color.GRAY);
    b1.addActionListener(this);
    b2.addActionListener(this);


    f = new JFrame();
    f.setSize(600,600);
    f.setVisible(true);        
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    p = new JPanel();
    p.setLayout(null);
    p.setBackground(Color.red);

    l1.setBounds(100,100,200,30);
    tf1.setBounds(250,100,200,30);
    l2.setBounds(100,150,200,30);
    tf2.setBounds(250,150,200,30);
    l3.setBounds(100,200,200,30);
    tf3.setBounds(250,200,200,30);
    l4.setBounds(100,250,200,30);
    tf4.setBounds(250,250,200,30);
    l5.setBounds(100,300,200,30);
    tf5.setBounds(250,300,200,30);
    l6.setBounds(100,350,200,30);
    tf6.setBounds(250,350,200,30);
    b1.setBounds(100,400,150,30);        
    b2.setBounds(300,400,150,30);


    p.add(l1);
    p.add(tf1);
    p.add(l2);
    p.add(tf2);
    p.add(l3);
    p.add(tf3);
    p.add(l4);
    p.add(tf4);
    p.add(l5);
    p.add(tf5);
    p.add(l6);
    p.add(tf6);
    p.add(b1);
    p.add(b2);

    f.add(p);


}




    public static void main(String args[])
    {
        New_Cust nc = new New_Cust();
    }

}


Advertisement
View Answers

Related Tutorials/Questions & Answers:
how to connect program to database
how to connect program to database  Sir i want ur help in my program. I want to save the data in the database. When i'll click on save button the entered data must be save in the database. I want an action performed method
How To Connect MS ACCESS 2003 Database in C Program with Graphics.
How To Connect MS ACCESS 2003 Database in C Program with Graphics.  How To Connect MS ACCESS 2003 Database in C Program with Graphics
Advertisements
How to connect with database
How to connect with database  jdbc connection
Connect to the database
Connect to the database  how to connect to the database in the iphone
how to connect to database in php using mysql
how to connect to database in php using mysql  how to connect to database in php using mysql
HOW TO CREATE COMMENT IN WEBSITE AND CONNECT TO DATABASE?
HOW TO CREATE COMMENT IN WEBSITE AND CONNECT TO DATABASE?  HOW TO CREATE COMMENT IN WEBSITE AND CONNECT TO DATABASE
HOW TO CREATE COMMENT IN WEBSITE AND CONNECT TO DATABASE?
HOW TO CREATE COMMENT IN WEBSITE AND CONNECT TO DATABASE?  HOW TO CREATE COMMENT IN WEBSITE AND CONNECT TO DATABASE
what is ment by jdbc and how to connect with database?
what is ment by jdbc and how to connect with database?  i want answer for this question
How to connect to the database to my application if my database is made up in oracle
How to connect to the database to my application if my database is made up in oracle   How to connect to the database to my application if my database is made up in oracle
how to connect to MS access database in JSP?
how to connect to MS access database in JSP?  how to connect to MS access database in JSP? Any seetings/drivers need to be set or installed before it? Please tell what needs to be done after creating a table with an example
how to connect j2me program with mysql using servlet?
how to connect j2me program with mysql using servlet?  my program...(a); } }; } servlet program is: import java.io.*; import java.util....(); String userid=connect(user.toLowerCase().trim(), pwd.toLowerCase().trim
how to connect jsp with sql database by netbeans in a login page?
how to connect jsp with sql database by netbeans in a login page?  how to connect jsp with sql database by netbeans in a login page
how to connect jsp with sql database by netbeans in a login page?
how to connect jsp with sql database by netbeans in a login page?  how to connect jsp with sql database by netbeans in a login page
how to connect jsp with sql database by netbeans in a login page?
how to connect jsp with sql database by netbeans in a login page?  how to connect jsp with sql database by netbeans in a login page
How to connect to database to my application if the database is made up in oracle
How to connect to database to my application if the database is made up in oracle  How to connect to database to my application if the database... Class.forName("oracle.jdbc.driver.OracleDriver"); 3) Connect to database
connect a web page to a database
connect a web page to a database  how to connect a web page to a database
TO connect multiple database
TO connect multiple database  How to connect several database from a single application in java depending upon the user input it will connect to that database
How to connect
How to connect  how to connect to a remote host using jsp? We need to update files to the database of the application on the local machine from the updated database on our webpage
How can I connect my database to my application ?
How can I connect my database to my application ?  How can I connect my database to my application?   Hi, You can use JDBC API to connect to database from your Java application. Here is the sample code to connect
connect database with javascript
connect database with javascript  can you please tell me how to connect database with javascript code. balaji.sivaramgari@gmail.com this is my mail id thanks in advance
how to connect the database using hibernet through servlet/jsp through form
how to connect the database using hibernet through servlet/jsp through form  plz give me the reply   Hi Friend, Please visit the following link: http://www.roseindia.net/jsf/myfacesspring/loginRegistration.shtml Hope
How to connect to MySql Database from Servlet?
; font-weight: bold; } How to connect to MySql Database from Servlet... will show you how to connect to MySQL database and perform select operation. You will learn the JDBC steps necessary to connect to the MySQL Database and execute
connect to the database from JSP
connect to the database from JSP  How do you connect to the database from JSP?   A Connection to a database can be established from a jsp page by writing the code to establish a connection using a jsp scriptlets
Connect database in Access to Netbean?
Connect database in Access to Netbean?  how to connect database in micrsoft access to Netbean?i know it can be connected by using JDBC-ODBC bridge, can i know the steps in connecting the database? Is there any source code
how can i create a mysql database to connect to this code - JDBC
how can i create a mysql database to connect to this code  i need help creating a mysql database for this code. code is import java.awt.*; import java.sql.*; import javax.swing.*; import java.awt.event.*; class
how can i create a mysql database to connect to this code - JDBC
how can i create a mysql database to connect to this code  i need help creating a mysql database for this code. code is import java.awt.*; import java.sql.*; import javax.swing.*; import java.awt.event.*; class
cannot connect to database - JDBC
cannot connect to database  Iam using eclipse in my system ,when connecting the database mysql version 5.0 to the eclipse iam getting an error as ""Creating connection to mysql has encountered a problem.Could not connect to mysql
Using Network Address To Connect to a Database
.style1 { text-align: center; } How To Use Network Address To Connect... to connect a MySql database with your application over a network then you must load... is "root" An example of using network address to connect to database
unable to connect database in java
unable to connect database in java  Hello Everyone! i was trying to connect database with my application by using java but i am unable to connect... i was using this code.... try { Driver d=(Driver)Class.forName
unable to connect database in java
unable to connect database in java  Hello Everyone! i was trying to connect database with my application by using java but i am unable to connect... i was using this code. try { Driver d=(Driver)Class.forName
how to connect webcam in html
how to connect webcam in html  how to connect webcam in html.emphasized text
 

 

 

DMCA.com