永发信息网

SQL SERVER 2005

答案:1  悬赏:70  手机版
解决时间 2021-05-08 00:31
  • 提问者网友:趣果有间
  • 2021-05-07 18:55

<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" " http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns=" http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>

<body>

<%
String username = request.getParameter("uid");
String password = request.getParameter("psd");

try {
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver").newInstance();
} catch (ClassNotFoundException e) {
System.out.print("数据库驱动程序装入错误");
}
String Url = "jdbc:sqlserver://localhost:1433; DatabaseName=test55";

Connection conn = DriverManager.getConnection(Url,sa,521988);

Statement stmt=conn.createStatement();


String sql = "insert into test55.dbo.student (uid,pwd) values ('8545','5668')";;

stmt.execute(sql);
stmt.close();

%>


</body>
</html>


Connection conn = DriverManager.getConnection(Url,sa,521988);这句错了什么??其他地方有错吗??

最佳答案
  • 五星知识达人网友:污到你湿
  • 2021-05-07 19:06

Connection conn = DriverManager.getConnection(Url,"sa","521988");


拜托了啊,用户名和密码要用引号,他是字符串啊,


采纳啊

我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯