No encuentra Registro con FWHMariaDB

No encuentra Registro con FWHMariaDB

Postby acuellar » Fri Jul 05, 2019 7:35 pm

Buenas estimados

No logro actualizar datos si existe el registro
Hago lo siguiente:
Code: Select all  Expand view

 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
acuellar
 
Posts: 1643
Joined: Tue Oct 28, 2008 6:26 pm
Location: Santa Cruz-Bolivia

Re: No encuentra Registro con FWHMariaDB

Postby vilian » Fri Jul 05, 2019 8:13 pm

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
vilian
 
Posts: 977
Joined: Wed Nov 09, 2005 2:17 am
Location: Brazil

Re: No encuentra Registro con FWHMariaDB

Postby acuellar » Fri Jul 05, 2019 10:54 pm

Thanks for answering Vilian

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

Adhemar C.
User avatar
acuellar
 
Posts: 1643
Joined: Tue Oct 28, 2008 6:26 pm
Location: Santa Cruz-Bolivia

Re: No encuentra Registro con FWHMariaDB

Postby vilian » Fri Jul 05, 2019 11:55 pm

Here it's working perfect !
Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
User avatar
vilian
 
Posts: 977
Joined: Wed Nov 09, 2005 2:17 am
Location: Brazil

Re: No encuentra Registro con FWHMariaDB

Postby nageswaragunupudi » Sat Jul 06, 2019 12:03 am

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  Expand view
oCtrl:Append( "USUARIO,ENTRA", { cUser,Datetime()} )

Actually, this is simpler and recommended.
Regards

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

Re: No encuentra Registro con FWHMariaDB

Postby nageswaragunupudi » Sat Jul 06, 2019 12:08 am

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  Expand view

oCtrl:SetOrder( "usuario" )
 

just after opening the rowset.

3. This sample program is working correctly here.
Code: Select all  Expand view
#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
nageswaragunupudi
 
Posts: 10641
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: No encuentra Registro con FWHMariaDB

Postby acuellar » Sat Jul 06, 2019 3:27 pm

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
acuellar
 
Posts: 1643
Joined: Tue Oct 28, 2008 6:26 pm
Location: Santa Cruz-Bolivia

Re: No encuentra Registro con FWHMariaDB

Postby nageswaragunupudi » Sat Jul 06, 2019 3:36 pm

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
nageswaragunupudi
 
Posts: 10641
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: No encuentra Registro con FWHMariaDB

Postby acuellar » Sat Jul 06, 2019 4:39 pm

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
acuellar
 
Posts: 1643
Joined: Tue Oct 28, 2008 6:26 pm
Location: Santa Cruz-Bolivia

Re: No encuentra Registro con FWHMariaDB

Postby nageswaragunupudi » Sat Jul 06, 2019 6:00 pm

You can also try
Code: Select all  Expand view

oRs:SetFilter( "TIPO = ?", { cTipo } )
 


If you use this approach, then later you can use refilter.
Example:
Code: Select all  Expand view

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

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

Re: No encuentra Registro con FWHMariaDB

Postby acuellar » Sat Jul 06, 2019 7:02 pm

Thanks very much

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

Code: Select all  Expand view

   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
acuellar
 
Posts: 1643
Joined: Tue Oct 28, 2008 6:26 pm
Location: Santa Cruz-Bolivia

Re: No encuentra Registro con FWHMariaDB

Postby nageswaragunupudi » Sat Jul 06, 2019 7:19 pm

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
nageswaragunupudi
 
Posts: 10641
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: No encuentra Registro con FWHMariaDB

Postby acuellar » Sat Jul 06, 2019 7:58 pm

:(

Thanks
Saludos,

Adhemar C.
User avatar
acuellar
 
Posts: 1643
Joined: Tue Oct 28, 2008 6:26 pm
Location: Santa Cruz-Bolivia

Re: No encuentra Registro con FWHMariaDB

Postby nageswaragunupudi » Sat Jul 06, 2019 8:00 pm

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: 10641
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: No encuentra Registro con FWHMariaDB

Postby nageswaragunupudi » Mon Jul 08, 2019 12:26 am

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
User avatar
nageswaragunupudi
 
Posts: 10641
Joined: Sun Nov 19, 2006 5:22 am
Location: India


Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: Adolfredo Martinez and 68 guests