Problem with JRadioButton and Access Database 2 Answer(s) 3 years and 3 months ago
Posted in : Java Beginners
Hello sir ,Here I have write following code to save text on JradioButton but this is not saved in Access Databse, I want to store course type in to database and also other fields value . plz help Me. import java.io.*; import java.awt.*; import javax.swing.*; import java.awt.event.*; import java.sql.*; import java.util.*;
savebtn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae){ int value1=Integer.parseInt(tf1.getText()); String value2=tf2.getText(); int value3=Integer.parseInt(tf3.getText()); int value4=Integer.parseInt(tf4.getText()); String g=text.getText(); System.out.println(g);
March 27, 2010 at 10:30 AM
continue..
try{ Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); Connection con =DriverManager.getConnection("jdbc:odbc:access","",""); PreparedStatement st=con.prepareStatement("insert into course(id,name,duration,fees,coursetype) values(?,?,?,?,?)"); st.setInt(1,value1); st.setString(2,value2); st.setInt(3,value3); st.setInt(4,value4); st.setString(5,g); st.executeUpdate(); JOptionPane.showMessageDialog(p1,"Data is successfully inserted into database."); con.close(); } catch(Exception e){ JOptionPane.showMessageDialog(p1,"Error in submitting data!"); } } }); deletebtn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae){ String value1=tf5.getText(); int ide=Integer.parseInt(value1); try{ Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); Connection con =DriverManager.getConnection("jdbc:odbc:mydsn","",""); PreparedStatement st=con.prepareStatement("DELETE FROM course WHERE id = ?"); st.setInt(1,ide); st.executeUpdate(); JOptionPane.showMessageDialog(p3,"Record is deleted successfully."); con.close(); } catch(Exception exp3){ JOptionPane.showMessageDialog(p3,"Error in deleting record."); } } }); editbtn1.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae){ String value=tf7.getText(); int ide=Integer.parseInt(value); try{ Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); Connection con =DriverManager.getConnection("jdbc:odbc:mydsn","",""); PreparedStatement st=con.prepareStatement("select * from course where id=?"); st.setInt(1,ide); ResultSet res=st.executeQuery(); res.next(); tf7.setText(Integer.toString(res.getInt(1))); tf8.setText(res.getString(2)); tf9.setText(res.getString(3)); tf10.setText(Integer.toString(res.getInt(4))); con.close(); } catch(Exception e) { JOptionPane.showMessageDialog(p2,"Can not edit data"); } } }); editbtn2.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae){ try { int x=JOptionPane.showConfirmDialog(p2,"Confirm edit? All data will be replaced"); if(x==0){ try{ int value1=Integer.parseInt(tf7.getText()); String value2=tf8.getText(); int value3=Integer.parseInt(tf9.getText()); int value4=Integer.parseInt(tf10.getText()); Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); Connection con =DriverManager.getConnection("jdbc:odbc:mydsn","",""); Statement st=con.createStatement(); //System.out.println("update course set name='"+value2+"', duration='"+value3+"',fees='"+value4+"' where id='"+value1+"'"); st.executeUpdate("update course set name='"+value2+"' , duration="+value3+",fees="+value4+" where id="+value1+""); JOptionPane.showMessageDialog(p2,"Updated successfully"); con.close(); } catch(Exception ex) { JOptionPane.showMessageDialog(p2,"Error in updating edit fields"); } } } catch(Exception ex) { JOptionPane.showMessageDialog(p2,"Error"); } } }); } void dis() { f.getContentPane().add(tp); tp.addTab("Add Record",p1); tp.addTab("Edit Record",p2); tp.addTab("Delete Record",p3); f.setSize(350,180); f.setVisible(true); f.setResizable(true); } public static void main(String z[]){ coursefrm pro=new coursefrm(); pro.dis(); } private ActionListener al = new ActionListener() { public void actionPerformed(ActionEvent e) { text.setText(((JRadioButton) e.getSource()).getText()); } }; }
Thanks
Related Pages:
Problem with JRadioButton and Access Database - Java Beginners Problem with JRadioButton and Access Database Hello sir ,Here I have write following code to save text on JradioButton but this is not saved in Access Databse,
I want to store course type in to database and also other fields
Save JRadioButton Text in to database - Java Beginners
Save JRadioButton Text in to database Hello Sir I have Two... JRadioBuuton in to Access Databse
and Access Databse. with user can select any one...=new JTextField(15);
final JRadioButton c1,c2;
ButtonGroup radioGroup=new
ACCESS DATABASE FROM HTML ACCESSDATABASE FROM HTML I want to access sql 2008 database in html page without help of ADODB connection.. because if access through ADODB means there is a security problem. so, Accessdatabase in html page(client side
connecting to access database Access Driver(*.mdb)
Select database name and Create the DSN name (e.g access...connecting to access database print("code sample");Hi I Write java... this there is no error but my data is not going to my Acess Database.
There is working
Problem with Double type Value in Access Database - Java Beginners Problem with Double type Value in Access Database Hello sir I have store Double Type Value in MS Access Databse,but when I search Record... Mobile Number with MS accessDatabase,plz Help Me Sir. Hi Friend
access access This is Nitha Sriram
i am having a problem that, i am having a combo box in the JSP page when i select an item from that i
am calling the onchange function.
In javascript i am getting the value now i want to pass
updation problem during transaction to ms-access
updation problem during transaction to ms-access Hey friends I am a beginner to java,and my problem is related to updation query in ms-access.Actually have created a database and through a jform button I am retrieving data
updation problem during transaction to ms-access
updation problem during transaction to ms-access Hey friends I am a beginner to java,and my problem is related to updation query in ms-access.Actually have created a database and through a jform button I am retrieving data
updation problem during transaction to ms-access
updation problem during transaction to ms-access Hey friends I am a beginner to java,and my problem is related to updation query in ms-access.Actually have created a database and through a jform button I am retrieving data
updation problem during transaction to ms-access
updation problem during transaction to ms-access Hey friends I am a beginner to java,and my problem is related to updation query in ms-access.Actually have created a database and through a jform button I am retrieving data
Problem in accessing data from Database Problem in accessing data from Database hi.....
i'm making a project on servlet and jsp with ms access 2007 at the backend. One field in my database... someone plz help me out with this problem
jfreechart display from access database data.
jfreechart display from accessdatabase data. I have made a database... to retrieve the data from the accessdatabase using prepared statement and then display... is to be done in a servlet..
Note that it is a access made database.
How can I
Extracting table from Access Database to Servlet
Extracting table from AccessDatabase to Servlet Sir,
I have a table with 4 field deptid, headid, normalexpend and projectexpend. Now I have...="h1".
The problem is that I have 20 heads and 10 depts which means I'll have
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
database problem database problem I did connect my jsp page to database and it showed the result on another jsp page but i want to show the data of that field on which i click to mouse from the jsp page where all the data field has been showed
database problem database problem I did connect my jsp page to database and it showed the result on another jsp page but i want to show the data of that field on which i click to mouse from the jsp page where all the data field has been showed
problem in database problem in database thanks for web site.
I want change this code to insert data into PostgreSql database using jsp,servlets.
but i getting...){
out.println("Couldn't load database driver: " + e.getMessage());
}
catch
Access 2007 database connectivity Access 2007 database connectivity i design an application form... source and destination. pls tell me the code of connectivity with access 2007 database using JComboBox.thanks
MS Access - JSP-Servlet
MS Access hello sir,
i want to use MS.Access as my database..so my problem is how to connect MS Acces database with servlets ...
thank you...
stepts
1.to configure the ms accessdatabase to your system
control panel
MS Access - WebSevices
help in solving problem.
In this example we have first created a DSN named "emp" which have accessdatabase and for images we have created a field in the table
getting problem in storing & retrieving value in database
getting problem in storing & retrieving value in database Hello everyone i am doing a project where my back end is ms access & i want to store value like 5353250214 so if i store it as long int in access it wont take it &
MS Access - JDBC
information about MS accessdatabase...but still i am having doubt in that topic.
My problem is : Is there any jar to connect MS Access and java ...
because... to be remember
1.to configure the ms accessdatabase to your system
control
Applet database access - Applet
Applet database access HI...
I'm having an applet where we should display the database values in the applet...
It works fine in the local system...
but when its in the server, we r getting null values in the local system..
I
how to access database in applet
how to accessdatabase in applet HI...
I'm having an applet where we should display the database values in the applet...
It works fine in the local system(same network)...
but when its in the server, we r getting null values
JSP and Database access
JSP and Database access Hi,
Please help me with the following program. I am not able to update all the pa column values in my database.
csea.jsp:
<html>
<body>
<%@page import="java.sql.*"%>
<form method
How To Insert A New Record to MS Access table database in GUI
How To Insert A New Record to MS Access table database in GUI Hello... that involves inserting a record into a 6-column table in my MS Accessdatabase table. I'm... on the actionPerformed events. The problem I'm having is that when the user clicks
java servlet connectivity problem with access
java servlet connectivity problem with access Import java.sql
javax.servlet
//all packages entered
try {
Class.forName...=con.createStatement();
^
i am confused what is the problem
problem in jsp using ms-access problem in jsp using ms-access after starting server(tomcat) wen v... and select the driver Microsoft Access Driver(*.mdb).
3)After selecting... the driver Microsoft Access Driver(*.mdb).
3)After selecting the driver, click
how to access the MS ACCESS database with java
how to access the MS ACCESSdatabase with java how to access the MS ACCESSdatabase with java how can we insert,delete,update,search records of ms access with java
Java MS Accessdatabase connectivity
Follow
MS-ACCESS Query Problem - SQL
MS-ACCESS Query Problem hi sir
i have table which is initially have empty records
Deleted
Attributes:
Roll
Name
Add
Age
Course
Class... = DriverManager.getConnection("jdbc:odbc:access");
Statement st
uploading problem
about file into database lib.
i use navicat Mysql ...
i use this code...
<...();
}
}
}
}
%>
my problem...:
firstly....
then problem solved...
bt real problem is when i upload files fusing mozilla
to access a date object - Java Server Faces Questions
to access a date object How to access a date value from the screen of Visual JSF to the DataBase java-Derby using NetBeans6.5. Hi friend,
For solving the problem visit to :
http://www.roseindia.net/jsf/visual
Database fetching problem Database fetching problem I have multiple database table and want to get all records in one object how can i do this.Pls guide
database connectivity problem database connectivity problem what if client dont have database with them then what is other way to run successfully our programm
Please visit the following link:
http://www.roseindia.net/jdbc
problem of static in jsp page by multiple user access problem of static in jsp page by multiple user access hi ,
i am continuing my online exam project,but i have a Singleton class which i am invoking from my jsp page , ths page can access by more number of users .every user
Oracle 9i database problem
Oracle 9i database problem Hi Somebody has given the solution but i.............,send reply immediately. I have a problem in Oracle9i .I have installed... what i created .But after closing the SQL+ ,the problem started.When i again opened
Database problem - WebSevices
simple database connectivity code. if you have any problem then send me detail...Database problem Hello,
How i connect my database file& tables to Zend library file. In which library file i should change that code
connectivity with access
; Is this Accessdatabase or excel sheet. Do you want to display the values...;Is this Accessdatabase or excel sheet. Do you want to display the values in Textarea...connectivity with access how to connect with data base with access
JAVA DB connenting Office access..
JAVA DB connenting Office access.. hai friends....iam shackir..
i... insertions are working fine...i cant understand what is the problem..."ANY ONE PLEASE... DriverManager class
//student_base is the name of the database
jasper problem - XML
jasper problem URGENT PROBLEM!!!!!!!!!!!!!
how can we use a hash table in jasper reports to generate reports without using database connection directly
but access data from the hash table what we needed for creation
database problem - JDBC database problem I installed Oracle 8.05 on Redhat 6.1 linux. If i fire up SQl plus seesion from the localhost, i can login succsfully as any user, If i go to a win98 or NT machine, I will get the following error after trying
coding problem using vb and access - Security
coding problem using vb and access i have problem on coding using vb on register button.when i click the label link it will terminate that program.so hard for me.i have no idea.
then i also have problem on update,delete and add