JDBC连接SQL出错??
为什么下面代码在执行时会出错??请大家指教!<%@ page contentType="text/html;charset=GB2312"%>
<%@ page import="java.sql.*"%>
<%!
Connection conn;
Statement s;
ResultSet rs;
String dbdriver="com.microsoft.jdbc.sqlserver.SQLServerDriver";
String url="jdbc:microsoft:sqlserver://127.0.0.1:1433;DatabaseName=pet";
%>
<%
try
{
Class.forName(dbdriver).newInstance();
conn=DriverManager.getConnection(url,"sa","123456");
s=conn.createStatement();
rs=s.executeQuery("insert into message (user,password) values('a','bbbbb')");
while(rs.next())
{
%>
<%=rs.getString(1)%><br>
<%
}
rs.close();
s.close();
conn.close();
}
catch(Exception e)
{
out.println(e);
}
%>
java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]在关键字 'user' 附近有语法错误。
[[it] 本帖最后由 Javapet 于 2008-3-6 12:55 编辑 [/it]]