CLOSE SLGRUP
USE SLGRUP
SLGRUP->(DBSETORDER(01))
DBSKIP(0)
oGruLbx:oDbf:= "SLGRUP"
oGruLbx:Refresh()
STATIC FUNCTION ADO_REFRESH( nWA, lRequery ) //22.08.15
LOCAL aWAData := USRRDD_AREADATA( nWA )
LOCAL nReccount
LOCAL nRecno, xKey, aSeek, oRs, cSql
LOCAL lOnlyfirstField := .T., oClone
IF !ADOCON_CHECK()
RETURN HB_FAILURE
ENDIF
nReccount := ADORECCOUNT( nWA, aWAData[ WA_RECORDSET ] )
lRequery := IF( lRequery == NIL, .F., lRequery )
IF !aWAData[ WA_RECORDSET ]:Eof() .AND.!aWAData[ WA_RECORDSET ]:bof()
nRecno := aWAData[ WA_RECORDSET ]:Fields(aWAData[WA_FIELDRECNO]):Value
ELSE
RETURN HB_SUCCESS
ENDIF
IF lRequery
ADO_REQUERY( nWA , aWAData[ WA_RECORDSET ] )
aWAData[ WA_RECCOUNT ] := nReccount
aWAData[ WA_LREQUERY ] := .T. //already requeried set to .f.
ADO_GOTO( nWA, nRecNo )
IF aWAData[ WA_RECORDSET ]:Eof()
// record does not exist anymore other app delete it!
THROW( ErrorNew( "ADORDD", 10002, 10002, "Record move "+aWAData [ WA_TABLENAME] ,;
STR( nRecNo )+ "was deleted by other app and ADORDD cant reposition " ) )
ENDIF
RETURN HB_SUCCESS
ENDIF
IF VALTYPE( aWAData[ WA_RECCOUNT ] ) == "U" //initialize
aWAData[ WA_RECCOUNT ] := nReccount
RETURN HB_SUCCESS
ELSE
// NEW RECORDS ADDED BY OTHERS?
IF aWAData[ WA_RECCOUNT ] < nReccount //only new records
//PAY ATTENTION TO ADOWHERECLAUSE AND SET RECORDSET OPEN WHERE CLAUSE BECAUSE THE NEW RECORD MIGHT NOT BE VISIBLE!
ADO_REQUERY( nWA , aWAData[ WA_RECORDSET ] )
aWAData[ WA_LREQUERY ] := .T. //already requeried set to .f.
//re initialize
aWAData[ WA_RECCOUNT ] := nReccount
ADO_GOTO( nWA, nRecNo )
IF aWAData[ WA_RECORDSET ]:Eof()
// record does not exist anymore other app delete it!
THROW( ErrorNew( "ADORDD", 10002, 10002, "Record move "+aWAData [ WA_TABLENAME] ,;
STR( nRecNo )+ "was deleted by other app and ADORDD cant reposition " ) )
ENDIF
ENDIF
ENDIF
RETURN HB_SUCCESS
Rick Lipkin wrote:Gemtleman
I have been using ( plain ) ADO ( class and methods ) for many years .. 32 and 64 bits ... Have a look in the samples folder and compile AdoRick.prg .. Uses all the Fivewin code .. xbrowse, panels, folders ... etc.
You can use ADO to connect to MS Sql Server, MS Access and ( most ) all the other Sql databases as well ... Rao has made the ADO connection syntax with many FiveWin wrappers .. Look in the \source\functions\adofuncs.prg ..
Thanks
Rick Lipkin
Otto wrote:Marc,
Do you also have speed problems on the PC where you saved your DBF files.
Regards,
Otto
// 30.06.15
IF aAWData[ WA_ENGINE ] = "ACCESS" .OR. aAWData[ WA_ENGINE ] = "SQLITE" .OR.;
aAWData[ WA_ENGINE ] = "FIREBIRD" .OR. aAWData[ WA_ENGINE ]== "POSTGRE" .OR.;
aAWData[ WA_ENGINE ]== "ORACLE" .OR. aAWData[ WA_ENGINE ]== "MYSQL" // ADICIONADO MYSQL
//6.08.15 ONLY WITH ACCESSIT TAKES LONGER IN BIG TABLES
cSql := "SELECT MAX("+( ADO_GET_FIELD_RECNO( aAWData[WA_TABLEINDEX] ) )+")+1 FROM "+aAWData[WA_TABLENAME]
ELSEIF aAWData[ WA_ENGINE ] = "MSSQL"
cSql := "SELECT IDENT_CURRENT('"+aAWData[WA_TABLENAME]+"')+1 AS AUTO_INCREMENT"
ELSE
//30.06.15 REPLACED BY RAO NAGES IDEA next incremente key
cSql := "SELECT `AUTO_INCREMENT` FROM INFORMATION_SCHEMA.TABLES"+;
" WHERE TABLE_SCHEMA = '"+aAWData[ WA_CATALOG ]+"' AND TABLE_NAME = '"+aAWData[ WA_TABLENAME ]+"'"
ENDIF
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: PabloHarbour and 68 guests