alka_duggal

Greenhorn
+ Follow
since Nov 28, 2000
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by alka_duggal

hi thanx for ur reply but my prog is still not working i want that processing should bo done when i click on modify button
but its not happenning
hi the ans is that
1 open MSAccess
2 open newfile
3 create database
4 give database name
5 click on create table design view
6 table will be made,write down fields
7 to prepare dsn,go to settings then ODBC then add access
then give dsn name, database path thats it

hi thanx 4 ur reply.but u could not understand my problem
my problem is with action performed part of the program next button is working but modify button is not working.
hi please tell me the way to write the program in which message passed on to client thru server and server to client using datagramsocket and datagrampacket
hi actually this is not my reply but a question for u that what r the queries that we use with prepared statement.i mean when we use executeupdate(we can use insert,delete,update)what else how do we use
hi i am alka
my problem is i cant run the program
import java.sql.*;
import java.awt.*;
import java.awt.event.*;
public class jdbc extends Frame implements ActionListener
{
TextField t1;
TextField t2;
Button b;
Button b1;
Button b2;
Button b3;
Button b4;
Button b5;
Button b6;
Panel P;
ResultSet rs;
Connection con;
Statement st;
public jdbc()
{
super("your data here");
setLayout(new GridLayout(5,1));
t1=new TextField(20);
t2=new TextField(20);
b=new Button("next");
b1=new Button("previous");
b2=new Button("exit");
b3=new Button("close");
b4=new Button("clear");
b5=new Button("modify");
b6=new Button("search");
P=new Panel();
add(new Label("name"));
add(t1);
add(new Label("class"));
add(t2);
add(P);
P.add(b);
P.add(b1);
P.add(b2);
P.add(b3);
P.add(b4);
P.add(b5);
P.add(b6);
b.addActionListener(this);
b1.addActionListener(this);
b2.addActionListener(this);
b3.addActionListener(this);
b4.addActionListener(this);
b5.addActionListener(this);
b6.addActionListener(this);
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con=DriverManager.getConnection("jdbc dbc:aa");
st=con.createStatement();
rs=st.executeQuery("select*from table1");
}
catch(Exception e)
{}
}
public static void main(String args[])
{
jdbc j=new jdbc();
j.setSize(300,300);
j.setVisible(true);
}
public void actionPerformed(ActionEvent ae)
{
if(ae.getSource()==b)
{
try
{
rs.next();
t1.setText(rs.getString(1));
t2.setText(rs.getString(2));
}
catch(Exception e)
{}
}
if(ae.getSource()==b5)
{
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con=DriverManager.getConnection("jdbc dbc:aa");
PreparedStatement ps=con.prepareStatement("insert into table1(name,class) values(?,?)");
t1.setText(rs.getString(1));
t2.setText(rs.getString(2));
ps.executeUpdate();
}
catch(Exception e)
{}
}
}
}
could any body tell me the solution