Page 1 of 1
No encuentra Registro con FWHMariaDB
Posted: Fri Jul 05, 2019 7:35 pm
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
Re: No encuentra Registro con FWHMariaDB
Posted: Fri Jul 05, 2019 8:13 pm
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()
Re: No encuentra Registro con FWHMariaDB
Posted: Fri Jul 05, 2019 10:54 pm
by acuellar
Thanks for answering Vilian
The problem is that it does not find if it already exists
Re: No encuentra Registro con FWHMariaDB
Posted: Fri Jul 05, 2019 11:55 pm
by vilian
Here it's working perfect !
Re: No encuentra Registro con FWHMariaDB
Posted: Sat Jul 06, 2019 12:03 am
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.
Re: No encuentra Registro con FWHMariaDB
Posted: Sat Jul 06, 2019 12:08 am
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
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.
Re: No encuentra Registro con FWHMariaDB
Posted: Sat Jul 06, 2019 3:27 pm
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
Re: No encuentra Registro con FWHMariaDB
Posted: Sat Jul 06, 2019 3:36 pm
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?
Re: No encuentra Registro con FWHMariaDB
Posted: Sat Jul 06, 2019 4:39 pm
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
Re: No encuentra Registro con FWHMariaDB
Posted: Sat Jul 06, 2019 6:00 pm
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" } )
Re: No encuentra Registro con FWHMariaDB
Posted: Sat Jul 06, 2019 7:02 pm
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
Re: No encuentra Registro con FWHMariaDB
Posted: Sat Jul 06, 2019 7:19 pm
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.
Re: No encuentra Registro con FWHMariaDB
Posted: Sat Jul 06, 2019 7:58 pm
by acuellar
Thanks
Re: No encuentra Registro con FWHMariaDB
Posted: Sat Jul 06, 2019 8:00 pm
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.
Re: No encuentra Registro con FWHMariaDB
Posted: Mon Jul 08, 2019 12:26 am
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.