• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 182
  • Last Modified:

how to call stored procedures using ADO/WFC?

In my J++ application ,i want to call a stored procedure in SQL server and get the output/return value using ADO/WFC,i tried several times using Connection and Command object but failed,can you help me? thank you!
1 Solution
What errors are you getting and for what data types? Have you tried something like this simple example?

Sql is:

   create proc SimpleSQL

     @i1  int output,
      @i2  int output,
       @i3  int output,
        @i4  int output

   select @i1 = 555,
          @i2 = 666,
          @i3 = 777,
          @i4 = 888

    return 999

Java is:

  CallableStatement stmt =
    conn.prepareCall(" { ? = call simpleSQL(?, ?, ?, ?) }");

  stmt.registerOutParameter(1, Types.SMALLINT);

    stmt.setInt(k,k * 100);
    stmt.registerOutParameter(k, Types.INTEGER);

  int count = stmt.executeUpdate();


Then use stmt.getInt(<parameterIndex>) to get the various integer data after this...

Featured Post

Take Control of Web Hosting For Your Clients

As a web developer or IT admin, successfully managing multiple client accounts can be challenging. In this webinar we will look at the tools provided by Media Temple and Plesk to make managing your clients’ hosting easier.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now