主题:插入数据怎么插2条?
<%@ page contentType="text/html;charset=gb2312" %>
<%@ page import="java.sql.*" %>
<%@ page import="java.io.*" %>
<%%>
<%
Connection conn=null;
Statement stm=null;
ResultSet rs=null;
String url="jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=girl";
String user="sa";
String pwd="good";
String lx=(String)request.getParameter("lx");
String name=(String)request.getParameter("id");
try{
Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver").newInstance();
}catch(ClassNotFoundException e) {e.printStackTrace();}
try{
conn=DriverManager.getConnection(url,user,pwd);
stm=conn.createStatement();
stm.executeUpdate("INSERT INTO Customer (CustomerName,CustomerType) VALUES ('"+name+"',1)");
}catch(SQLException ex){ ex.getMessage();}
response.sendRedirect("index.jsp");
%>
<%@ page import="java.sql.*" %>
<%@ page import="java.io.*" %>
<%%>
<%
Connection conn=null;
Statement stm=null;
ResultSet rs=null;
String url="jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=girl";
String user="sa";
String pwd="good";
String lx=(String)request.getParameter("lx");
String name=(String)request.getParameter("id");
try{
Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver").newInstance();
}catch(ClassNotFoundException e) {e.printStackTrace();}
try{
conn=DriverManager.getConnection(url,user,pwd);
stm=conn.createStatement();
stm.executeUpdate("INSERT INTO Customer (CustomerName,CustomerType) VALUES ('"+name+"',1)");
}catch(SQLException ex){ ex.getMessage();}
response.sendRedirect("index.jsp");
%>