Connection conn=null;
String strSql="";
try
{
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
String strConn="jdbc:sqlserver://localhost:1433;DatabaseName=date";
String strUser="sa";
String strPassword="123456";
conn=DriverManager.getConnection(strConn,strUser,strPassword);
Statement stmt=conn.createStatement();
String pid=request.getParameter("p_id");
if (pid!=null || pid!="")
session.setAttribute("pid",pid);
strSql="select * from product where p_id='"+pid+"'";
ResultSet rs=stmt.executeQuery(strSql);
rs.next();
%>
注册
编号:
账户:/>
密码:/>
价格:/>
rs.close();
stmt.close();
conn.close();
}
catch(ClassNotFoundException e)
{
out.println(e.getMessage());
}
catch(SQLException e)
{
out.println(e.getMessage());
}
%>
展开