OT: easy? dblib question

Gerry gerry at ship-to-order.com
Wed Mar 21 18:34:50 EST 2001


I'm not too fluent with dblib or SQL Server so I was wondering if 
someone here might be able to help me out. I want to get the value 
returned by a stored procedure and can't figure out how to do it. Here 
is my attempt (which results in a segmentation fault at dbbind):

   dbcmd(dbproc, "DECLARE @return_status FLOAT");
   dbsqlexec(dbproc);

   sprintf(sqlstr, "EXEC @return_status=sp_SendOrderToWMS 
@intInternalOrderId=%d", (int) orderid);

   dbcmd(dbproc, sqlstr);
   dbsqlexec(dbproc);

   dbcmd(dbproc, "SELECT @return_status");
   dbsqlexec(dbproc);
   while ((return_code = dbresults(dbproc)) != NO_MORE_RESULTS) {
       if (return_code == SUCCEED) {
           dbbind(dbproc, 1, FLT8BIND, 0, (BYTE *) &return_status);

           while (dbnextrow(dbproc) != NO_MORE_ROWS) {
               printf("*** return_status = %d\n", (int) return_status);
           }

       }
   }

Any help is greatly appreciated. BTW - I'm binding to floats because I 
had trouble binding to INTs elseware with FreeTDS.

Thanks,

Gerry




More information about the FreeTDS mailing list