[求助]在sql server2000中执行sql命令的错误,
我在jsp中,需要执行sql命令,他总是出现,java.sql.SQLException: [Microsoft][ODBC SQL Server Driver][SQL Server]第 1 行: '='有错误程序如下:
<%
request.setCharacterEncoding("gb2312");
String id=request.getParameter("id");
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection conn=DriverManager.getConnection("jdbc:odbc:server");
Statement stmt=conn.createStatement();
ResultSet rs;
String sql="select * from Sliuyan where id='"+id+"'";
try{
rs=stmt.executeQuery(sql);
while(rs.next()){
String name=rs.getString("name");
String title=rs.getString("title");
String content=rs.getString("content");
String Stime=rs.getString("Stime");
session.setAttribute("title",title);
%>
<table width="592" height="254" border="1" align="center" cellspacing="0" bgcolor="#FDC755">
<tr>
<th width="125" height="33" scope="col">主题</th>
<th width="457" scope="col"><%=title%> </th>
</tr>
<tr>
<td height="31">作者</td>
<td><%=name%> </td>
</tr>
<tr>
<td height="34">留言时间</td>
<td><%=Stime%> </td>
</tr>
<tr>
<td height="113">留言内容</td>
<td><%=content%> </td>
</tr>
</table>
<%
}
String hfsql="select * from Shuifu biaoji='"+id+"'";
ResultSet hfrs=stmt.executeQuery(hfsql);
while(hfrs.next())
{
String hfStime=rs.getString("Stime");
String hfcontent=rs.getString("content");
%>
<table width="592" height="149" border="1" align="center" cellspacing="0" bgcolor="#FDC755">
<tr>
<td width="125" height="34">答复时间</td>
<td width="457"><%=hfStime%> </td>
</tr>
<tr>
<td height="113">留言内容</td>
<td><%=hfcontent%> </td>
</tr>
</table>
<%}
}catch(Exception e){
e.printStackTrace();
}
%>
<table width="592" border="1" align="center" cellspacing="0" bgcolor="#FDC755">
<tr>
<th height="26" scope="col"><a href="liuyan.jsp">返回留言板</a> <a href='javascript:openwindow()'>学生会答复</a></th>
</tr>
</table>
<p align="center"><a href="javascript:window.close();" class="STYLE1">关闭本窗口</a></p>
</body>