Error converting nvarchar to int
843854Mar 21 2002 — edited Apr 24 2002Trying to call a stored procedure from jsp page using a bean on SQL server getting "Error converting nvarchar to int".
Here are the details..
Stored Procedure
IN paramaters-int,int,datetime,datetime,bigint,bigint
INOUT parameters-bigint,bigint
call from jsp
AvgSP avg=new AvgSP();
long avg1=avg.AvgValue(1,1000,"2002-02-01 00:00:00","2002-02-28 00:00:00",(long)0.0,(long)0.0);
Bean:
public long AvgValue(int val1, int val2, String start_date, String end_date, long val4, long val6)throws SQLException, ClassNotFoundException
{
aConnection = DBConnection.getConnection();
QueryEvaluator qEval = QueryEvaluator.getInstance(aConnection);
CallableStatement CS = aConnection.prepareCall("{call AVG[?,?,?,?,?,?)]}");
CS.setInt( 1, val1);
CS.setInt( 2, val2);
Timestamp start_datetime = Timestamp.valueOf(start_date);
Timestamp end_datetime = Timestamp.valueOf(end_date);
CS.setTimestamp(3, start_datetime);
CS.setTimestamp(4, end_datetime);
CS.setLong(5, val5);
CS.setLong(6, val6);
CS.registerOutParameter(5, Types.BIGINT);
CS.registerOutParameter(6, Types.BIGINT);
CS.execute();
long avg =CS.getLong(5);
return avg;
}
Please help me find the cause for this error.