?? inse.java
字號:
import java.awt.*;
import java.awt.event.*;
import javax.swing.* ;
import java.sql.* ;
import java.lang.Object ;
public class inse
{
Integer userid ;
Integer waterprice ;
Integer gasprice ;
Integer watermoney ;
Integer gasmoney ;
Integer zong ;
Integer water ;
Integer gas ;
String name ;
String address ;
PreparedStatement prepStmt = null ;
ResultSet rsd = null ;
public inse(Integer userid,String name,String address)
{
try
{
Timestamp ti = new Timestamp(System.currentTimeMillis()) ;
conn conn = new conn("wanglei","wanglei") ;
prepStmt = conn.conn.prepareStatement("insert into users values(?,?,?,?)") ;
prepStmt.setInt(1,userid) ;
prepStmt.setString(2,name) ;
prepStmt.setString(3,address) ;
prepStmt.setTimestamp(4,ti) ;
rsd = prepStmt.executeQuery() ;
}
catch(Exception e)
{ JOptionPane.showMessageDialog(new JFrame(), "Wrong users", "Dialog",
JOptionPane.ERROR_MESSAGE);
}
}
public inse(Integer waterpi,Integer gaspi)
{
try
{
Timestamp ti = new Timestamp(System.currentTimeMillis()) ;
conn conn = new conn("wanglei","wanglei") ;
prepStmt = conn.conn.prepareStatement("insert into price values(?,?,?)") ;
prepStmt.setInt(1,waterpi) ;
prepStmt.setInt(2,gaspi) ;
prepStmt.setTimestamp(3,ti) ;
rsd = prepStmt.executeQuery() ;
}
catch(Exception ex)
{ JOptionPane.showMessageDialog(new JFrame(), "Wrong insert price", "Dialog",
JOptionPane.ERROR_MESSAGE);
}
}
public inse(Integer userid,Integer water,Integer gas,Integer watermoney,Integer gasmoney,Integer zong)
{
try
{
Timestamp ti = new Timestamp(System.currentTimeMillis()) ;
conn conn = new conn("wanglei","wanglei") ;
prepStmt = conn.conn.prepareStatement("insert into da values(?,?,?,?,?,?,?)") ;
prepStmt.setInt(1,userid) ;
prepStmt.setInt(2,water) ;
prepStmt.setInt(3,gas) ;
prepStmt.setInt(4,watermoney) ;
prepStmt.setInt(5,gasmoney) ;
prepStmt.setInt(6,zong) ;
prepStmt.setTimestamp(7,ti) ;
rsd = prepStmt.executeQuery() ;
}
catch(Exception ec)
{ JOptionPane.showMessageDialog(new JFrame(), "Wrong insert da", "Dialog",
JOptionPane.ERROR_MESSAGE);
}
}
}//inse
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -