Consulta MariaDBConnection

Post Reply
User avatar
MarioG
Posts: 1356
Joined: Fri Oct 14, 2005 1:28 pm
Location: Resistencia - Chaco - AR

Consulta MariaDBConnection

Post by MarioG »

Buenos dias!
Hago esta consulta:

Code: Select all

::oConn0:RowSet("SET @nCredito=0.00;" + ;
                "SELECT FeCobro AS Fecha, PuntoVta, CompNro, CompTipo, CompxNC," + ;
                "CONCAT( RTrim(TUT.TutorFac),' ',if(CompTipo=13, 'NC a Rbo.Nº', ''),' ',if(CompTipo=13,CONVERT(RIGHT(CompxNC,8),SIGNED),'') ) AS Detalle," + ;
                "MntoNeto, MntoCobrado AS Facturado, @nCredito AS Credito, TUT.id_tutor " + ;
                "FROM cabercbos AS RCBO " )
Me devuelve error: Invalid SQL: SET @nCredito=0.00;

Cual es la forma correcta?; gracias!
Resistencia - "Ciudad de las Esculturas"
Chaco - Argentina
User avatar
MarioG
Posts: 1356
Joined: Fri Oct 14, 2005 1:28 pm
Location: Resistencia - Chaco - AR

Re: Consulta MariaDBConnection

Post by MarioG »

He encontrado mi error.
Debo usar EXECUTE, no ROWSET
De manera que hago esto: (considerando que puedo estar errado)

Code: Select all

   ::oConn0:Execute( "SET @nCredito=0.00" )
   oQryViewFac:= ::oConn0:RowSet("SELECT FeCobro AS Fecha, PuntoVta, CompNro, CompTipo, CompxNC," + ;
                                 "CONCAT( RTrim(TUT.TutorFac),' ',if(CompTipo=13, 'NC a Rbo.Nº', ''),' ',if(CompTipo=13,CONVERT(RIGHT(CompxNC,8),SIGNED),'') ) AS Detalle," + ;
                                 "MntoNeto, MntoCobrado AS Facturado, @nCredito AS Credito, TUT.id_tutor " + ;
                                 "FROM cabercbos AS RCBO " + ;
                                 "LEFT JOIN vista_tutores AS TUT ON TUT.id_tutor=RCBO.id_tutor " + ;
                                 "WHERE RCBO.id_tutor="+FW_ValToSQL(nIDTutor)+" AND FeCobro BETWEEN ? AND ?" + ;
                                 " ORDER BY FeCobro DESC,CompNro DESC", {dFeIni, dFeFin} )
Hasta acá la respuesta es la deseada.
Luego a esto lo presento en un xBrowse, donde @nCredito AS Credito es la columna 5

Code: Select all

      REDEFINE XBROWSE aO[_oBrwCF] ID BRW_XBRW OF oDlg AUTOSORT ;
               COLUMNS aColumns[_FeCobro], aColumns[_CompNum], aColumns[_Detalle], aColumns[_Facturado], aColumns[_Credito] ;
               HEADERS aHeaders[_FeCobro], aHeaders[_CompNum], aHeaders[_Detalle], aColumns[_Facturado], aColumns[_Credito] ;
               OBJECT oQryViewFac  FASTEDIT
Y de acá pretendo que tal columna 5 (Credito) sea editable

Code: Select all

:bOnPostEdit:= {|o,nC,nK| if( nK != VK_ESCAPE, o:Value:= nC , ) }
Como se puede ver, el xbrowse es FASTEDIT. Y ocurre que no hace nada ni al teclear un numero, ni al pulsar RETURN
Resistencia - "Ciudad de las Esculturas"
Chaco - Argentina
Post Reply