Skip to main content

Posts

Showing posts with the label accept value from user using bufffered reader and insert into msaccess database

accept value from user using bufffered reader and insert into msaccess database

accept value from user using buffered reader and insert into ms access database import java.sql.*; import java.io.*; class BufferedInsert { public static void main(String s[]) { try {              BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));              // it is used to accept value runtime System.out.println("Enter The name"); String nm = reader.readLine();  System.out.println("Enter The ID");     int id = Integer.parseInt(reader.readLine()); Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); //driver load             Connection con=DriverManager.getConnection("jdbc:odbc:demodb"); // connection             PreparedStatement psmt=con.prepareStatement("insert into demo(id,dname)values(?,?)"); psmt.setInt(1,id); psmt.setString(2,nm); ...

Labels

Show more