Close
jGuru Forums
Posted By: Ahmed_tantan Posted On: Wednesday, March 6, 2002 01:14 PM
I am have created the following test stored procedure in sql server 7. CREATE procedure show_test2 @ID int as DECLARE @CustName as varchar(30) SELECT @CustName = (select CustName from tblCustomer where ID = @ID) SELECT @CustName Now, To call this Stored_Procedure from a java program I did the following: try { con = DriverManager.getConnection("jdbc:JSQLConnect://Server", "sa", ""); cs = con.prepareCall ("{?=call show_test2(?)}"); cs.registerOutParameter(1, java.sql.Types.VARCHAR); cs.setInt(2,ID); rs = cs.executeQuery(); System.out.println("CustName for CuIntID is " + rs.getString(1)); } catch (SQLException eSQL) { well, the code compiles fine, but when i execute the program I get " ResultSet has no current row " but when I test this procedure in sql server I get the results expected. my question is, can some one please take look at the code and see if i am reading the out paramter correctly. Thanks Ahmed
Re: Help: Calling a stored Procedure
Posted By: Marc_Moore Posted On: Thursday, March 7, 2002 04:04 PM