I use MariaDB and DataRow and I get an error when I add a record in filtered recordsource
CUSTID (in the example) is incorrect.
Maybe I use the commands incorrectly but with ADO it works correctly.
- Code: Select all Expand view
- #include "fivewin.ch"
static aStr := { "208.91.198.197:3306,fwhdemo,gnraofwh,Bharat@1950", ;
"209.250.245.152,fwh,fwhuser,FiveTech@2022" }
static oCn
//----------------------------------------------------------------------------//
function Main()
local oRs, cSql,oRec
FWSetLanguage( 1 )
FW_SetUnicode( .t. )
if ( oCn := maria_Connect( aStr[ 1 ], .t. ) ) != nil
TEXT INTO cSql
SELECT C.ID AS CustID, C.FIRST AS CustName, C.AGE AS AG, C.STATE AS ST, S.NAME AS StateName
FROM customer C
LEFT OUTER JOIN states S ON C.STATE = S.CODE
ORDER BY CUSTID
ENDTEXT
oRs := oCn:RowSet( cSql )
// xbrowse(oRs)
oRec := TDataRow():New( oRs, nil, .t.)
oRec:CUSTNAME := 'PIPPO'
oRec:Save()
? 'Last CUSTID :' + str(oRec:CUSTID ) + '* OK *' + ' Name:' + oRec:CUSTNAME
oRs:Filter = "CUSTNAME = 'Tom'"
xbrowse(oRs)
oRec := TDataRow():New( oRs, nil, .t.)
oRec:CUSTNAME := 'Frank'
oRec:Save()
? 'Last CUSTID :' + str(oRec:CUSTID ) + '* ERROR *' + ' Name:' + oRec:CUSTNAME
/*
XBROWSER oRs FASTEDIT AUTOSORT AUTOFIT SHOW RECID ;
TITLE "Compare Editability Vs Other Libs" ;
SETUP ( oBrw:lFastEdit := .f., oBrw:aCols[ 4 ]:cEditPicture := "@!" )
*/
oCn:Close()
endif
return nil
Regards Maurizio
www.nipeservice.com