java.sql.SQLException: No suitable driver found for jdbc:microsoft:sqlserver://127.0.0.1:1433;
我对这个不懂,但要交作业,麻烦高手指点一下,步骤写详细些(比如代码添加到哪)谢谢了,下面是我d9.jsp文件的代码<%@pagecontentType="text/htm...
我对这个不懂,但要交作业,麻烦高手指点一下,步骤写详细些(比如代码添加到哪)谢谢了,下面是我d9.jsp文件的代码<%@ page contentType="text/html;charset=GB2312" %>
<%@ page import="java.sql.*" %>
<HTML>
<BODY bgcolor=cyan text=blue><center>
<Font size=4>
<P>删除记录:
<FORM action="delete.jsp" method=post>
输入被删除记录的学号:
<Input type="text" name="number">
<BR>
<BR><Input type="submit" name="b" value="提交删除">
</FORM>
<P>数据库删除前的数据记录是:
<%
String driver="com.microsoft.jdbc.sqlserver.SQLServerDriver";
String url1= "jdbc:microsoft:sqlserver://127.0.0.1:1433;DatabaseName=tengfei";
String name,number;
int math,physics,english;
Connection con;
Statement sql;
ResultSet rs;
try{Class.forName(driver);
}
catch(ClassNotFoundException e){}
try { con=DriverManager.getConnection(url1,"sa","");
sql=con.createStatement();
rs=sql.executeQuery("SELECT * FROM CJ");
out.print("<Table Border>");
out.print("<TR>");
out.print("<TH width=100>"+"学号");
out.print("<TH width=100>"+"姓名");
out.print("<TH width=50>"+"高等数学成绩");
out.print("<TH width=50>"+"英语成绩");
out.print("<TH width=50>"+"法律成绩");
out.print("</TR>");
while(rs.next())
{ out.print("<TR>");
number=rs.getString(1);
out.print("<TD >"+number+"</TD>");
name=rs.getString(2);
out.print("<TD >"+name+"</TD>");
math=rs.getInt("高等数学成绩");
out.print("<TD >"+math+"</TD>");
english=rs.getInt("英语成绩");
out.print("<TD >"+english+"</TD>");
physics=rs.getInt("法律成绩");
out.print("<TD >"+physics+"</TD>");
out.print("</TR>") ;
}
out.print("</Table>");
con.close();
}
catch(SQLException e1) {}
%>
</Font>
</center>
</BODY>
</HTML> 展开
<%@ page import="java.sql.*" %>
<HTML>
<BODY bgcolor=cyan text=blue><center>
<Font size=4>
<P>删除记录:
<FORM action="delete.jsp" method=post>
输入被删除记录的学号:
<Input type="text" name="number">
<BR>
<BR><Input type="submit" name="b" value="提交删除">
</FORM>
<P>数据库删除前的数据记录是:
<%
String driver="com.microsoft.jdbc.sqlserver.SQLServerDriver";
String url1= "jdbc:microsoft:sqlserver://127.0.0.1:1433;DatabaseName=tengfei";
String name,number;
int math,physics,english;
Connection con;
Statement sql;
ResultSet rs;
try{Class.forName(driver);
}
catch(ClassNotFoundException e){}
try { con=DriverManager.getConnection(url1,"sa","");
sql=con.createStatement();
rs=sql.executeQuery("SELECT * FROM CJ");
out.print("<Table Border>");
out.print("<TR>");
out.print("<TH width=100>"+"学号");
out.print("<TH width=100>"+"姓名");
out.print("<TH width=50>"+"高等数学成绩");
out.print("<TH width=50>"+"英语成绩");
out.print("<TH width=50>"+"法律成绩");
out.print("</TR>");
while(rs.next())
{ out.print("<TR>");
number=rs.getString(1);
out.print("<TD >"+number+"</TD>");
name=rs.getString(2);
out.print("<TD >"+name+"</TD>");
math=rs.getInt("高等数学成绩");
out.print("<TD >"+math+"</TD>");
english=rs.getInt("英语成绩");
out.print("<TD >"+english+"</TD>");
physics=rs.getInt("法律成绩");
out.print("<TD >"+physics+"</TD>");
out.print("</TR>") ;
}
out.print("</Table>");
con.close();
}
catch(SQLException e1) {}
%>
</Font>
</center>
</BODY>
</HTML> 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询