I am developing android application. And i am using sql sever 2008 database to store and retrieve the data. Now i am calling the stored procedure in jbdc. Here is the code. Now it gives me Exception which says Invalid Column Index at 3. I am using the same code in other place which works fine. Bt don't know why nt working here. Give proper advice if you have any idea. Thank You.
I just found out that when the String dat = rs.getSt开发者_开发百科ring(3); is executing it shows the above exception. Let me tell you that in stored procedures it was datetime. But it executes well. Any suggestions do help me.
Here is the stored Procedure
From looking at your java code, it would appear that your parameters are either OUT or INOUT params. If that is the case, you probably need to register them as such, so you can get data from them.
eg
cst.setInt(1,userId);
cst.setLong(2,taskId);
cst.setString(3, date);
cst.registerOutParameter(1, Types.NUMERIC);
cst.registerOutParameter(2, Types.NUMERIC);
cst.registerOutParameter(3, Types.VARCHAR);
rs = cst.executeQuery();
Hopefully, that should fix your problem.
精彩评论