Error with MariaDB and DataRow

Error with MariaDB and DataRow

Postby Maurizio » Wed May 22, 2024 9:25 am

Hello Rao,
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
User avatar
Maurizio
 
Posts: 799
Joined: Mon Oct 10, 2005 1:29 pm

Re: Error with MariaDB and DataRow

Postby Maurizio » Tue Jun 04, 2024 9:59 am

Hello RAO
could you see this post?
Maurizio
User avatar
Maurizio
 
Posts: 799
Joined: Mon Oct 10, 2005 1:29 pm

Re: Error with MariaDB and DataRow

Postby Eroni » Tue Jun 04, 2024 3:04 pm

Maurizio, I do not use tDataRow(), but it works for me:

Code: Select all  Expand view
oRec := oRs:Record( .F. ) // or .T. to insert


Wouldn't that be missing?

Regards.
FWH 1709 BCC72 MySql MariaDB
Visual Studio 2019 / Xamarin / C#
User avatar
Eroni
 
Posts: 97
Joined: Fri Jul 21, 2006 7:15 pm
Location: Criciuma/SC Brazil

Re: Error with MariaDB and DataRow

Postby nageswaragunupudi » Thu Jun 06, 2024 4:04 pm

Code: Select all  Expand view
oRec := oRs:Record( .F. ) // or .T. to insert

and
Code: Select all  Expand view
oRec  := TDataRow():New( oRs, nil, .t.)// .t. or .f.

are same.
Regards

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

Re: Error with MariaDB and DataRow

Postby nageswaragunupudi » Thu Jun 06, 2024 4:04 pm

We will test and get back
Regards

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


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 129 guests