??????(form) - PowerPoint PPT Presentation

1 / 15
About This Presentation
Title:

??????(form)

Description:

Title: PowerPoint Presentation Author: Lzl Last modified by: mimidema Created Date: 1/1/1601 12:00:00 AM Document presentation format: (4:3) – PowerPoint PPT presentation

Number of Views:60
Avg rating:3.0/5.0
Slides: 16
Provided by: Lzl6
Category:
Tags: connection | form | java | jdbc

less

Transcript and Presenter's Notes

Title: ??????(form)


1
??? ????????(?)
2
????
  • ????????????????????????????????????
  • ??????????,??????????????????????????

3
???????????
  • ??????(form)
  • ?????????(???????)
  • ??????
  • ????,????,???????????SQL????(select)
  • ?????????????????(?????)?ResultSet???
  • ????ResultSet??,?????????
  • ?????????????????

4
?????
  • JFrame???????
  • ActionListener?actionPerformed??
  • ??????
  • ??????????
  • ??ResultSet????????
  • Main??

5
????
  • import ????
  • public class A0602 extends JFrame implements
    ActionListener
  • A0602()
  • ?????(???????????????)
  • public void actionPerformed(ActionEvent event)
  • try
  • ???????????
  • ?????????????
  • catch (ClassNotFoundException e)
  • System.out.println("?????????")
  • catch (SQLException e)
  • System.out.println("?????????")
  • public static void main(String args)
  • new A0602()

6
(No Transcript)
7
(No Transcript)
8
(No Transcript)
9
(No Transcript)
10
(No Transcript)
11
??????????(??)
  • String sql "SELECT FROM CUSTOMER WHERE
    CUSTOMER_ID'"txtId.getText()"'"
  • Connection conn null
  • try
  • Class.forName("oracle.jdbc.driver.OracleDriver")
  • conn DriverManager.getConnection
  • ("jdbcoraclethin_at_192.168.210.2281521orcl","
    stu10","swufe111")
  • Statement stmt conn.createStatement()
  • ResultSet rs stmt.executeQuery(sql)
  • if(rs.next())txtName.setText(rs.getString(2))
  • else txtName.setText("lt????gt")
  • rs.close()stmt.close()conn.close()System.out.p
    rintln("????")
  • catch (ClassNotFoundException e)System.out.printl
    n("?????????,???")
  • catch (SQLException e)System.out.println("???????
    ??,SQL???" sql)

12
????????ResultSet???????
  • import java.sql.
  • public class A060201
  • public static void main(String args)
  • String sql "SELECT FROM CUSTOMER"
  • Connection conn null
  • try
  • Class.forName("oracle.jdbc.driver.OracleDriver
    ")
  • conn DriverManager.getConnection("jdbcoracl
    ethin_at_192.168.210.2281521orcl","stu10","swufe1
    11")
  • Statement stmt conn.createStatement()
  • ResultSet rs stmt.executeQuery(sql)
  • while(rs.next())
  • System.out.println(rs.getString(1)"\t"rs.get
    String(2)"\t"rs.getString(5))
  • rs.close()
  • stmt.close()
  • conn.close()
  • System.out.println("????")
  • catch (ClassNotFoundException
    e)System.out.println("?????????,???")

13
?????????????????
  • import java.sql.
  • public class A060202
  • public static void main(String args)
  • String sql "SELECT FROM CUSTOMER"
  • Connection conn null
  • try
  • Class.forName("oracle.jdbc.driver.OracleDriver
    ")
  • conn DriverManager.getConnection("jdbcoracl
    ethin_at_192.168.210.2281521orcl","stu10","swufe1
    11")
  • Statement stmt conn.createStatement()
  • ResultSet rs stmt.executeQuery(sql)
  • while(rs.next()) System.out.println(rs.ge
    tString("cust_name")"\t"rs.getString("customer_i
    d")"\t"rs.getString("cust_city")"\t"rs.getStri
    ng("CUST_GENDER"))
  • rs.close()
  • stmt.close()
  • conn.close()
  • System.out.println("????")
  • catch (ClassNotFoundException
    e)System.out.println("?????????,???")
  • catch (SQLException e)System.out.println("????
    ?????,SQL???" sql)

14
??
  • ??????
  • ??????
  • ?????????(deposit?)
  • ????????????????

15
???
  • ?????deposit?????????,????????????????????????,???
    ???
  • ?????account??deposit?????????,???????????????????
    ??,??????
Write a Comment
User Comments (0)
About PowerShow.com