teststore03.java

来自「此程序都是企业级 的数据库开发程序 全面揭示了JAVA对数据库的操作」· Java 代码 · 共 35 行

JAVA
35
字号
package connections;

public class TestStore03 {
  public static void main(String[] args) {
    int id = 3;
    Store03 store = new Store03();
    boolean result = store.findByPrimaryKey("3");
    if (result) {
      System.out.println("Store retrieved successfully");
      System.out.println(store.toString());
    } else {
      System.out.println("Store NOT retrieved successfully");
      return;
    } 

    System.out.println("Updating local data for store");
    store.setStoreAddress1("1370 Denny Way");
    store.setStoreCity("Seattle");
    store.setStorePostalCode("98001");

    System.out.println("Attempting to update database");
    result = store.update();
    if (result) {
      System.out.println("Store updated successfully");
    } else {
      System.out.println("Store NOT updated successfully");
      return;
    } 

    // retrieve again to show update
    store = new Store03();
    store.findByPrimaryKey("3");
    System.out.println(store.toString());
  }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?