是不是mssqlserver,jar、msbaew.jar、msutil.jar三个驱动包呀!
这是我做的公交车查询系统的主页(gjcx.html),我想根据用户的查询信息的不同,动态生成表格,自动转到(index1)去,可是不能成功!
这是gjcx.html
<p-equiv="Content-Type" content="text/html; charset=gb2312"><html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>南昌市公交车查询</title>
</head>
<body bgcolor="#E6E6E6">
<h1 align="center"><font color="#FF0000">南昌市公交车查询</font></h1>
<table width="340" height="0" border="0" align="center">
<tr>
<td height="30">
<div align="left"><B>请输入您要查询的信息:</B></div></td>
</tr>
</table>
<form method=get action=index1.jsp>
<table width="340" border="0" align="center" cellpadding="1" cellspacing="1">
<tr>
<td width="165" height="30">
<div align="center"><B>按公交车线路查询:</B></div></td>
<td width="168" height="30">
<INPUT size=15
name=mima>
路</td>
</tr>
<tr>
<td height="28"> </td>
<td><INPUT type=submit value=查询 name=submit>
<input type=submit
value=取消 name=submit2> </td>
</tr>
</table></form>
<form method=get action=index2.jsp>
<table width="340" border="0" align="center" cellpadding="1" cellspacing="1">
<tr>
<td width="164" height="30" rowspan="2">
<div align="center"><B>按站点(地点)查询:</B></div></td>
<td width="169" height="30"> 起点
<INPUT size=15
name=mima2>
</td>
</tr>
<tr>
<td height="26">终点
<INPUT size=15
name=mima22></td>
</tr>
<tr>
<td height="30"> </td>
<td height="30">
<INPUT type=submit value=查询 name=submit3> <input type=submit
value=取消 name=submit22> </td>
</tr>
</table></form>
<table width="340" height="30" border="0" align="center">
<tr>
<td><h3 align="center">说 明:</h3></td>
</tr>
<tr>
<td> 按地点查询时,“起点”不能为空,“终点”可为空,您可以试着输入一个地点查看有哪些线路经过此地;</td>
</tr>
</table>
</body>
</html>
index1.jsp
<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta http-equiv="content-Language“ content="zh-cn">
<title>线路查询</title>
</head>
<body bgcolor="#E6E6E6">
<center>
<table width="592" height="93" border=1 align="center">
<tr>
<td width="29" height="28"> <div align="center"><strong>车次</strong></div></td>
<td width="34"><div align="center"><strong>始发站</strong></div></td>
<td width="41"><div align="center"><strong>终点站</strong></div></td>
<td width="373"><div align="center"><strong>运行线路</strong></div></td>
<td width="45"><div align="center"><strong>无人售票</strong></div></td>
<td width="30"><div align="center"><strong>票价</strong></div></td>
</tr>
<%
try
{
//装载驱动程序
Class.forName("com.mircrosoft.jdbc.sqlserver.SQLServerDriver").newInstance
//创建连接
Connection con=java.sql.DriverManager.getConnection("jdbc:mircrosoft:sqlserver:
//127.0.0.1:8080;DatabaseName=BUS")
statement stmt=con.createment();
ResultSet res=stmt.executeQuery("select*from contact;)
while(rs.next())
{
<td height="57"> <div align="center"><%=rs.getString("bus_num")%></div></td>
<td><div align="center"><%=rs.getString("S_stop")%></div></td>
<td><div align="center"><%=rs.getString("E_stop")%></div></td>
<td><div align="center"><%=rs.getString("bus_line")%></div></td>
<td><div align="center"><%=rs.getString("wrsp")%></div></td>
<td><div align="center"><%=rs.getString("T_price")%></div></td>
</tr>
}
//关闭连接
rst.close();
stmt.close();
con.close();
}catch(SQLException e)
{
out.println("Cann't load the DataBase!");
e.printStackTrace();
}
%>
</table>
<p>
</center>
</body>
</html>
请问我的代码是对的吗?数据库还是连不上,我快疯了!高手帮帮我吧!!