getInt() doesnt work, mad!
843835Mar 11 2002 — edited Mar 11 2002Help, the result I get from recordset getInt() is different from that of getString(), mad! From the code below, sDummy2 will get the correct result from MsAccess using getString(), but iSub_no will get the wrong result 0 which is the initialization value using getInt().
In Access, the field nxt_sys_no is integer.
Please help if you can, many thanks u all...Peter
<%@ page import="java.lang.*,java.util.*,java.text.*,java.sql.*;"%>
<%
response.setContentType("text/vnd.wap.wml");
%>
<%
String sSql1
int iSub_no = 0;
int iPolicy_no = 0;
sSql1 = "SELECT sys_no_name, nxt_sys_no FROM TSYSNO";
StringBuffer sDummy1 = null;
StringBuffer sDummy2 = null;
java.sql.Statement oStatement;
java.sql.ResultSet oResultSet = null;
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
String sourceURL = "jdbc:odbc:AIUTravel";
java.sql.Connection oConnection = java.sql.DriverManager.getConnection(sourceURL);
oStatement = oConnection.createStatement();
oResultSet = oStatement.executeQuery(sSql1);
while(oResultSet.next()){
sDummy1 = new StringBuffer(oResultSet.getString("sys_no_name"));
sDummy2 = new StringBuffer(oResultSet.getString("nxt_sys_no"));
iSub_no = oResultSet.getInt("nxt_sys_no");
iPolicy_no = oResultSet.getInt("nxt_sys_no");
}
}
catch(ClassNotFoundException cnfe){
System.err.println(cnfe);
}
catch(java.sql.SQLException sqle){
System.err.println(sqle);
}
%>
<?xml version="1.0" encoding="ISO-8859-1"?><!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org//DTD//wml_1.1.xml">
<wml>
<!--Nokia Parser Info: Phone = Nokia 6250; Height = 80; Width = 130; CurrentDeckSize = 38; MaxDeckSize = 1397; CardsOnEachLine = 5; CardsVerticalGap = 30-->
<template>
<do type="options" name="Prev" label="Previous">
<prev/>
</do>
</template>
<card id="cdMain" title="Request Confirmation" ordered="true" newcontext="false">
<p align="left">Thank you for your submission</p>
<p align="left"><%=sDummy1%></p>
<p align="left"><%=sDummy2%></p>
<p align="left"><%=iSub_no%></p>
<p align="left"><%=iPolicy_no%></p>
<do type="options" name="Prev" label="Previous">
<noop/>
</do>
</card>
</wml>