No encuentra Registro con FWHMariaDB

Post Reply
User avatar
acuellar
Posts: 1312
Joined: Tue Oct 28, 2008 6:26 pm
Location: Santa Cruz-Bolivia

No encuentra Registro con FWHMariaDB

Post by acuellar »

Buenas estimados

No logro actualizar datos si existe el registro
Hago lo siguiente:

Code: Select all

 FWCONNECT oCn HOST ViaServer USER "root" PASSWORD cPass DB "rrhh"
 oCtrl:=oCn:RowSet( "SELECT * FROM control ORDER BY usuario" )

  If oCtrl:Seek( cUser )
     ? "Found"
     oCtrl:Update( "USUARIO,ENTRA", { cUser,Datetime()} )
   Else
     ? "NoFound"
    oCtrl:Append( "USUARIO,ENTRA", { cUser,Datetime()} ) 
   Endif 
 
Siempre me sale NoFound

Gracias por la ayuda
Saludos,

Adhemar C.
User avatar
vilian
Posts: 795
Joined: Wed Nov 09, 2005 2:17 am
Location: Brazil
Contact:

Re: No encuentra Registro con FWHMariaDB

Post by vilian »

Hi,

I think you should change this:

oCtrl:Append( "USUARIO,ENTRA", { cUser,Datetime()} )

By this:

oCtrl:Append()
oCtrl:usuario := cUser
oCtrl:entra := DateTime()
oCtrl:Save()
Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
User avatar
acuellar
Posts: 1312
Joined: Tue Oct 28, 2008 6:26 pm
Location: Santa Cruz-Bolivia

Re: No encuentra Registro con FWHMariaDB

Post by acuellar »

Thanks for answering Vilian

The problem is that it does not find if it already exists
Saludos,

Adhemar C.
User avatar
vilian
Posts: 795
Joined: Wed Nov 09, 2005 2:17 am
Location: Brazil
Contact:

Re: No encuentra Registro con FWHMariaDB

Post by vilian »

Here it's working perfect !
Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: No encuentra Registro con FWHMariaDB

Post by nageswaragunupudi »

vilian wrote:Hi,

I think you should change this:

oCtrl:Append( "USUARIO,ENTRA", { cUser,Datetime()} )

By this:

oCtrl:Append()
oCtrl:usuario := cUser
oCtrl:entra := DateTime()
oCtrl:Save()
This works

Code: Select all

oCtrl:Append( "USUARIO,ENTRA", { cUser,Datetime()} )
Actually, this is simpler and recommended.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: No encuentra Registro con FWHMariaDB

Post by nageswaragunupudi »

acuellar wrote:Thanks for answering Vilian

The problem is that it does not find if it already exists
1. Please let us know the FWH version you are using. Let us test with your version.

2. If you are using a much older version:
Please try adding

Code: Select all

oCtrl:SetOrder( "usuario" )
 
just after opening the rowset.

3. This sample program is working correctly here.

Code: Select all

#include "fivewin.ch"

function Main()

   local oCn, oRs

   oCn   := FW_DemoDB()
   oRs   := oCn:RowSet( "select * from states order by code" )
   if oRs:Seek( "ny" )
      ? "Found", oRs:Code, oRs:Name
   else
      ? "not found"
   endif
   oRs:Close()
   oCn:Close()

return nil
 
Can you test this program with your version and let us know if the seek is working for you.
Regards

G. N. Rao.
Hyderabad, India
User avatar
acuellar
Posts: 1312
Joined: Tue Oct 28, 2008 6:26 pm
Location: Santa Cruz-Bolivia

Re: No encuentra Registro con FWHMariaDB

Post by acuellar »

Thanks Mr. Rao.

I have FWH1804

It works with If oCtrl:Seek( Alltrim(cUser) )
And I have SET EXACT OFF

Other
what function replaces ClipValue2SQL()

Thanks very much
Saludos,

Adhemar C.
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: No encuentra Registro con FWHMariaDB

Post by nageswaragunupudi »

oCn:ValToSQL( uValue )

But when you use the methods of Connection and Rowset objects, you never need to use oCn:ValToSQL( uValue ) directly.
We recommend the oCn and oRs methods to take care of the conversion rather than you do it independently.

May we know why and where do you need to use this directly?
Regards

G. N. Rao.
Hyderabad, India
User avatar
acuellar
Posts: 1312
Joined: Tue Oct 28, 2008 6:26 pm
Location: Santa Cruz-Bolivia

Re: No encuentra Registro con FWHMariaDB

Post by acuellar »

Thanks Mr Rao

May we know why and where do you need to use this directly?
oRs:Filter:="TIPO = " + oCn:ValToSQL( cTipo )

Regards
Saludos,

Adhemar C.
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: No encuentra Registro con FWHMariaDB

Post by nageswaragunupudi »

You can also try

Code: Select all

oRs:SetFilter( "TIPO = ?", { cTipo } )
 
If you use this approach, then later you can use refilter.
Example:

Code: Select all

oRs:SetFilter( "state = ?", { "NY" } )
// after some work
oRs:Refilter( { "WA" } )
 
Regards

G. N. Rao.
Hyderabad, India
User avatar
acuellar
Posts: 1312
Joined: Tue Oct 28, 2008 6:26 pm
Location: Santa Cruz-Bolivia

Re: No encuentra Registro con FWHMariaDB

Post by acuellar »

Thanks very much

Because when you filter in the search locate records that do not belong to the filter

Code: Select all

   oSQL:SetFilter( "TIPO = ?", { cTipo } )
   oSQL:SetOrder( "nombre",,.F. )
   nRec := oSQL:KeyCount() 
   oSQL:GoTop()  
    @41,192 xBrowse oBrw Of oWnd SIZE aCoors[4]-515, aCoors[3]-258 PIXEL DATASOURCE oSQL AUTOSORT COLUMNS "NOMBRE" HEADER "NOMBRE" SIZES nAncho
   oBrw:nMarqueeStyle:=4 
   oBrw:lIncrFilter:= .t.
   oBrw:lSeekWild  := .t.
   oBrw:CreateFromCode()
  @4,160 SAY oBrw:oSeek PROMPT oBrw:cSeek SIZE 120,12 PIXEL OF oBrw  PICTURE '@!' 
 
Regards
Saludos,

Adhemar C.
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: No encuentra Registro con FWHMariaDB

Post by nageswaragunupudi »

You are right.
That is an issue with xbrowse of all datasources dbf, ado, etc.
Issuse with DBF is fixed in FWH 1905
We try to fix the issue with other datasources also now.
Regards

G. N. Rao.
Hyderabad, India
User avatar
acuellar
Posts: 1312
Joined: Tue Oct 28, 2008 6:26 pm
Location: Santa Cruz-Bolivia

Re: No encuentra Registro con FWHMariaDB

Post by acuellar »

:(

Thanks
Saludos,

Adhemar C.
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: No encuentra Registro con FWHMariaDB

Post by nageswaragunupudi »

For now, in case you want to use incremental filters with xbrowse, use a rowset read with where clause. Do not use filter.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: No encuentra Registro con FWHMariaDB

Post by nageswaragunupudi »

Mr. Adhemar

This issue is resolved in FWH1906 for MariaDB RowSets also.
Now the browse incremental filters do not disturb the existing filters and work as additional filters.
Regards

G. N. Rao.
Hyderabad, India
Post Reply