Ver Mensaje Individual
  #1 (permalink)  
Antiguo 03/12/2008, 12:35
adescalz
 
Fecha de Ingreso: mayo-2008
Mensajes: 4
Antigüedad: 18 años, 5 meses
Puntos: 0
Mensaje ADODB InParameter no incluye parametro

Estoy trabajando con ADODB y al usar PrepareSP y luego InParameter, al imprimir el array que envio a Execute, veo que no esta el parametro.

el error que sale es
[Microsoft][ODBC SQL Server Driver][SQL Server]Procedure or function 'test' expects parameter '@UserTipo', which was not supplied.

si ejecuto "EXECUTE test 'US'" funciona perfectamente.

Código PHP:
    // configuracion Datos Tango
    
$GestionBD_hostname    = "server";
     
$GestionBD_username    = "sa"; 
    
$GestionBD_password    = "";
    
$GestionBD_type    = "odbc_mssql";
    
$GestionBD_basededatos    = "MYDB";
    
$GestionBD_dbdns        = "Driver={SQL Server};Server=" . $GestionBD_hostname . ";Database=" . $GestionBD_basededatos . ";";
    
$GestionBD        = NULL;
    
    
$GestionBD =& ADONewConnection($GestionBD_type);
    
$GestionBD->debug = false;
    
$GestionBD->Connect($GestionBD_dbdns, $GestionBD_username, $GestionBD_password);
    
$GestionBD->SetFetchMode(ADODB_FETCH_ASSOC); 

    
$TipoUsuario = "US";
    
$stmt = $GestionBD->PrepareSP("test", false); 
    
$GestionBD->InParameter($stmt, $TipoUsuario,"UserTipo");
    
$recordSet = $GestionBD->Execute($stmt);
    
    print 
'<pre>';
    
print_r($stmt);
    print 
'</pre>';
    
    if (!
$recordSet) 
    {
        print 
$GestionBD->ErrorMsg();
    }
    else
    {
        print 
"<table>\n";
        while (!
$recordSet->EOF)
        {
            print 
"<tr>\n";
            for (
$x=0; $x<$recordSet->FieldCount();$x++)
            {
                
$fld = $recordSet->FetchField($x);
                
$type = $recordSet->MetaType($fld->type);
            
                print 
"<td>";
                print 
$recordSet->Fields($fld->name);
                print 
"</td>\n";
            }
            
$imprimirColumna = false;
            
$recordSet->MoveNext();
            print 
"</tr>\n";
        }
        print 
"</table>\n";
    }