pushhhh
This commit is contained in:
19
Eclipse-Workspace/prg4_b2_38/src/in/test/updatedemo.java
Normal file
19
Eclipse-Workspace/prg4_b2_38/src/in/test/updatedemo.java
Normal file
@@ -0,0 +1,19 @@
|
||||
package in.test;
|
||||
import java.sql.*;
|
||||
|
||||
public class updatedemo {
|
||||
public static void main(String[] args) throws Exception{
|
||||
Class.forName("com.mysql.cj.jdbc.Driver");
|
||||
Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/jdbc_B2_38", "root", "12345");
|
||||
PreparedStatement ps = con.prepareStatement("update student set Name='AAA' where Rollno=104");
|
||||
int i = ps.executeUpdate();
|
||||
if(i>0) {
|
||||
System.out.println("success");
|
||||
}
|
||||
else {
|
||||
System.out.println("fail");
|
||||
}
|
||||
con.close();
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user