本帖最后由 tianshan20081 于 2011-12-25 15:29 编辑
- String sql = "select top ? * from article ";
- try {
- ps = conn.prepareCall(sql);
- ps.setInt(1,5);
- rs = ps.executeQuery();
复制代码- com.microsoft.sqlserver.jdbc.SQLServerException: '@P0' 附近有语法错误。
- at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:197)
- at com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(SQLServerStatement.java:1493)
- at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doExecutePreparedStatement(SQLServerPreparedStatement.java:390)
- at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement$PrepStmtExecCmd.doExecute(SQLServerPreparedStatement.java:340)
- at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:4575)
- at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:1400)
- at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(SQLServerStatement.java:179)
- at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(SQLServerStatement.java:154)
- at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.executeQuery(SQLServerPreparedStatement.java:283)
- at com.zsc.csdn.Test.main(Test.java:18)
复制代码 |