Calling a MSSQL stored procedure in Java -


i have access stored procedure on sql server has 1 parameter , can run on sql client follow:

exec sp_name "2016/11/01" 

now want same thing in java.

preparedstatement ps = conn.preparestatement("sp_name ?"); ps.setstring(1, "2016/11/01"); resultset rs = ps.executequery(); 

in rs can see columns' names, 0 row returned. think because of stored procedure's parameter. missing here?

here code worked eventually:

string date= "2016/11/01" string querystring "exec sp_dmp_pub_status ?"; preparedstatement ps = conn.preparestatement(querystring);          simpledateformat format = new simpledateformat("yyyy/mm/dd"); date parsed = format.parse(date); java.sql.date sqldate = new java.sql.date(parsed.gettime()); ps.setdate(1, sqldate);         resultset rs = ps.executequery(); 

Comments

Popular posts from this blog

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -