LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

CVI SQL TOOLKIT : Fetching records with Interbase/Firebird stored procedure.

Hye.
 
I want to fetch records from a Interbase/Firebird stored procedure.
I know how to execute a stored procedure that just returns a return code. I have test this and it works.
 
The stored procedure just done a SELECT command on a single table and return records. It does'nt have input parameters just an smallint output parameter named 'idcentral'.
 
This is the text of my stored procedure :
 
begin
for
 select ID_CENTRAL 
 from Centralisateur
 into :"IDCENTRAL"
do
  suspend;
end
 
Note : ID_CENTRAL is a smallint type column
          idcentral is a output parameter
 
 
I Just want to read the return records in my CVI application. This is the code :
 
 
short idCentral = 0;    
   resCode = DBSetAttributeDefault (db_handle, ATTR_DB_COMMAND_TYPE,DB_COMMAND_STORED_PROC);
   hstmt = DBPrepareSQL (db_handle, "PR_SELECT_CENTRAL");
   resCode = DBSetAttributeDefault (db_handle, ATTR_DB_COMMAND_TYPE,DB_COMMAND_UNKNOWN);
   /* Refresh the parameters from the stored procedure. */
   //resCode = DBRefreshParams (hstmt);
   
   resCode = DBCreateParamShort(hstmt, "central", DB_PARAM_OUTPUT, idCentral);
   resCode = DBExecutePreparedSQL (hstmt);
   while ((resCode = DBFetchNext (hstmt)) == DB_SUCCESS)
   {
    /* Lecture valeur colonne 1 du record courant. */
    resCode = DBGetColShort (hstmt, 1, &idCentral);
   }    
    
   // Pour libérer des ressources proprement
   resCode = DBClosePreparedSQL(hstmt);  
   resCode = DBDeactivateSQL(hstmt);
 
Is this the right way to fetch the records as results ?
I use the refreshparams() function but it does'nt work best.
 
Could you help me or give me links to Internet sites.
 
thanks.
 
 
 
0 Kudos
Message 1 of 2
(3,423 Views)

OK!

It was a problem on the EASYSOFT ODBC Driver.

I have selected a bad option.

 

0 Kudos
Message 2 of 2
(3,400 Views)