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



Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


farhat sultana
java
0 Answer(s)      4 years and 8 months ago
Posted in : IDE Questions


sir

i have 2 tables namely FEES(Fileno,Stname,Totalfee,Feepaid,Balance) and INSTALMENT(Fileno,Stname,Totalfee,Balance,Instalmentpaid,Balancetobepaid)

i am retreiving Fileno , Stname , Totalfee ,Balance into INSTALMENT table from FEES table , my Balance value is not updated once Instalmentapaid amount is entered so please tell me how to get updated value . i am using swing

i am sending code below for ur help , please answer as early as u can .

if(e.getSource()==fee)
{

try
{
// String fileno=tcfile.getText().toString();
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con=DriverManager.getConnection("jdbc:odbc:MyDataSource");
stat=con.prepareStatement("INSERT INTO fees VALUES(?,?,?,?,?,?,?)");
String fileno=tcfile.getText();
String stname=tcname.getText();
String totfee=tctot.getText();
String balance=tcbal.getText();
String duedate=tcinsdate.getText();
String noins=tinsno1.getText();
String receiptno=tcrecipt.getText();
stat.setInt(1,Integer.parseInt(fileno));
stat.setString(2,stname);
stat.setInt(3,Integer.parseInt(totfee));
stat.setInt(4,Integer.parseInt(balance));
stat.setString(5,duedate);
stat.setInt(6,Integer.parseInt(noins));
stat.setInt(7,Integer.parseInt(receiptno));

stat.executeUpdate();
con.commit();
JOptionPane.showMessageDialog(null,"fees details are saved","MESSAGE",JOptionPane.PLAIN_MESSAGE);

con.close();
}
catch(Exception er)
{
JOptionPane.showMessageDialog(null,"please check ","MESSAGE",JOptionPane.PLAIN_MESSAGE);



}
}
if(e.getSource()==balb)
{
int k=Integer.parseInt(tcadv.getText());
int p=Integer.parseInt(tctot.getText());
int bal=0;
bal=(p-k);
tcbal.setText(String.valueOf(bal));
int p1=Integer.parseInt(tcinsamt.getText());
int b=Integer.parseInt(tcbal.getText());

int no=0;

no=b/p1;

tinsno1.setText(String.valueOf(no));

}
if(e.getSource()==totb)
{
int a=Integer.parseInt(tcfee.getText());
int b=Integer.parseInt(tchostel.getText());
int c=Integer.parseInt(tctrans.getText());
int d=Integer.parseInt(tcdis.getText());
int sum=0;
float dis=0;
int tot=0;

sum=(a+b+c)-d;

tctot.setText(String.valueOf(sum));
// System.exit(0);
}
if(e.getSource()==details)
{

try
{

//String fileno=insfile.getText().toString();
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con=DriverManager.getConnection("jdbc:odbc:MyDataSource");
stat=con.prepareStatement("INSERT INTO instalment VALUES(?,?,?,?,?,?,?,?,?,?)");
String fileno=tinsfno.getText();
String stname=tinsname.getText();
String totfee=tinstotfee.getText();
String bal=tinsbalance.getText();
String duedate=tinsduedate.getText();
String noofinstalment=tinsno.getText();
String balpay=tinsbal.getText();
String paydate=tinspaydate.getText();
String baltobepaid=tinsdue.getText();
String receipt=tinsreceipt.getText();

stat.setInt(1,Integer.parseInt(fileno));
stat.setString(2,stname);
stat.setInt(3,Integer.parseInt(totfee));
stat.setInt(4,Integer.parseInt(bal));
stat.setString(5,duedate);
stat.setInt(6,Integer.parseInt(noofinstalment));
stat.setInt(7,Integer.parseInt(balpay));
stat.setString(8,paydate);
stat.setInt(9,Integer.parseInt(baltobepaid));
stat.setInt(10,Integer.parseInt(receipt));

stat.executeUpdate();
con.commit();

JOptionPane.showMessageDialog(null,"instalment details are saved","MESSAGE",JOptionPane.PLAIN_MESSAGE);
//con.close();

// String fileno=tinsfno.getText().toString();
con=DriverManager.getConnection("jdbc:odbc:MyDataSource");
stat=con.prepareStatement("update fees set balance=? where fileno=?");
String balance=tinsdue.getText();
stat.setInt(4,Integer.parseInt(balance));
stat.executeUpdate();
con.commit();
con.close();

}
catch (Exception er)
{
JOptionPane.showMessageDialog(null,"please check","MESSAGE",JOptionPane.PLAIN_MESSAGE);
}
}

I want to get instalment table like this depending upon the no of instalment

No of instalment Fileno Stdname Balance Duedate Balance pay Paydate Balancetp be paid
1 5001 Patrick 200 2/5/2010 50 3/5/20 150
2 5001 Patrick 150 2/6/2010 40 2/6/2010 110
3 5001 Patrick 110 2/7/2010 50 2/7/2010 60
4 5001 Patrick 60 2/8/2010 30 2/8/2010 30


5 5001 Patrick 30 2/9/2010 30 5/9/2010 0


Advertisement
View Answers

Related Tutorials/Questions & Answers:
java
java  diff bt core java and java
java
java  what is java
Advertisements
Java
Java   Whether Java is pure object oriented Language
java
java  different between java & core java
java
java  explain technologies are used in java now days and structure java
java
java   why iterator in java if we for loop
JAVA
JAVA  how the name came for java language as "JAVA
java
java  what is java reflection
java
java  is java open source
java
what is the size of array in java ?  what is the size of array in java ? what is the mean of finalize in java
java
java   in java does not pointers concept but what is nullpointers in java?   nullpointer is a runtime Exception
java
java  write a java program using filenotfoundexception
Java
Java  how to draw class diagrams in java
java
java   difference between class and interface
java
java  why multiple inheritance is not possible in java
java
java  explain object oriented concept in java
java
java  is java purely object oriented language
Java
Java   Whether Java is Programming Language or it is SOftware
java
java  what are JAVA applications development tools
java
java  how use java method
java
java  send me java interview questions
java
java  write a program in java to acess the email
java
java  Write a java code to print "ABABBABCABABBA
java
java  why to set classpath in java
java
java  why to set classpath in java
java
java  why to set classpath in java
java
java  why to set classpath in java
java
java  give a simple example for inheritance in java
java
java  give a simple example for inheritance in java
Java
Java  how to do java in command prompt
java
java  Does java allows multiline comments
Advertisements
 

 

 

DMCA.com