<%@ page import="java.sql.*" %>
JSP Requête de Mise à Jour
Insertion dans Table
<%
Connection connection = null;
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
connection = DriverManager.getConnection("jdbc:odbc:Users", "userName", "password");
Statement statement = connection.createStatement();
String command = "INSERT INTO vip_user (ID, Name, email) VALUES (1, 'Joe', 'test@gmail.com')";
statement.executeUpdate(command);
command = "INSERT INTO vip_user (ID, Name, email) VALUES (2, 'steve', 'demo@demo.com')";
statement.executeUpdate(command);
// Afficher le contenu de la table
ResultSet resultset =
statement.executeQuery("select * from vip_user");
while(resultset.next()){
%>
ID
Name
Email
<%= resultset.getString(1) %>
<%= resultset.getString(2) %>
<%= resulset.getString(3) %>
<%
}
%>