JSP页面调用存储过程问题
- <%@ page language="java" contentType="text/html; charset=gb2312"
- pageEncoding="gb2312"%>
- <%@ page import="java.sql.Connection"%>
- <%@ page import="java.sql.DriverManager"%>
- <%@ page import="java.sql.Statement"%>
- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
- <title>执行打印记录的信息</title>
- </head>
- <%
- //获取当前页编号ID的值
- String ID = (String) request.getParameter("ID");
- String dllname= (String) request.getParameter("dllname");
- //定义您的驱动器及数据库的URL、用户名和密码
- String driverName = "com.microsoft.sqlserver.jdbc.SQLServerDriver";
- String url = "jdbc:sqlserver://192.168.0.2:1433;databaseName=klrq";
- String username = "SA";
- String password = "GUOOUG";
- Connection con = null;
- try {
- // 创建数据库连接
- Class.forName(driverName);
- con = DriverManager.getConnection(url, username, password);
- // 创建数据库执行语句
- Statement sqlstatement = con.createStatement();
- // 将对应编号ID是否打印字段改为true
- sqlstatement
- .execute("exec yu @id='" +ID+"' , @dllname='"+dllname+"'");
- con.close();
- } catch (Exception e) {
- e.printStackTrace();
- }
- %>
- <body>
- </body>
- </html>
复制代码
|
FineReportyuzhifu
发布于 2012-5-14 14:58
提示:增加悬赏、完善问题、追问等操作,可使您的问题被置顶,并向所有关注者发送通知