預聲明之刪除
阿新 • • 發佈:2017-05-20
rom oid exception println cut where oca exce jdb
package com.lianxi; import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.util.Scanner; public class Shanchu { public static void main(String[] args) throws Exception { Class.forName("com.mysql.jdbc.Driver"); Connection conn=DriverManager.getConnection("jdbc:mysql://localhost:3306/boooks","root","tiger"); PreparedStatement ps=conn.prepareStatement("delete from tb_user where userno=?"); Scanner s=new Scanner(System.in); System.out.println("請輸入用戶編號"); int no=s.nextInt(); ps.setInt(1, no); ps.execute(); conn.close(); } }
預聲明之刪除