Wonderful!I'm converting a big app and till now in browses didn't need to change a single line of code!

Wonderful!I'm converting a big app and till now in browses didn't need to change a single line of code!
Code: Select all
[#ifndef __XHARBOUR__
#xcommand TRY => BEGIN SEQUENCE WITH {| oErr | Break( oErr ) }
#xcommand CATCH [<!oErr!>] => RECOVER [USING <oErr>] <-oErr->
#xcommand FINALLY => ALWAYS
#include "fivewin.ch" // as Harbour does not have TRY / CATCH IF YOU DONT HAVE COMENT THIS LINE
#define UR_FI_FLAGS 6
#define UR_FI_STEP 7
#define UR_FI_SIZE 5 // by Lucas for Harbour
//13.04.15 functions given by thefull to compile with Harbour WITHOUT FIVEWIN
function cValToChar( u ); return CStr( u )
function MsgInfo( u ) ; return Alert( u )
function MsgAlert( u ); return Alert( u )
function cFilePath( cPathMask ) // returns path of a filename
local n := RAt( "\", cPathMask ), cDisk
return If( n > 0, Upper( Left( cPathMask, n ) ),;
( cDisk := cFileDisc( cPathMask ) ) + If( ! Empty( cDisk ), "\", "" ) )
function cFileNoPath( cPathMask )
local n := RAt( "\", cPathMask )
return If( n > 0 .and. n < Len( cPathMask ),;
Right( cPathMask, Len( cPathMask ) - n ),;
If( ( n := At( ":", cPathMask ) ) > 0,;
Right( cPathMask, Len( cPathMask ) - n ),;
cPathMask ) )
function cFileNoExt( cPathMask ) // returns the filename without ext
local cName := AllTrim( cFileNoPath( cPathMask ) )
local n := RAt( ".", cName )
return AllTrim( If( n > 0, Left( cName, n - 1 ), cName ) )
function cFileDisc( cPathMask ) // returns drive of the path
return If( At( ":", cPathMask ) == 2, ;
Upper( Left( cPathMask, 2 ) ), "" )
#pragma BEGINDUMP
#include <hbapi.h>
HB_FUNC( LAND )
{
hb_retl( ( hb_parnl( 1 ) & hb_parnl( 2 ) ) != 0 );
}
#pragma ENDDUMP
#endif
/code]
Code: Select all
nrec := recno()
if seek "whatever whatever2" // 2 fields in seek expression // 1) new recordset 2) the same
do while seek expression = .t.
....
skip
enddo
endif
go to nrec // 1) out of the scope needs to revert to previous record set 2) the same record set :find that record
Please explain this point.AHF wrote:Cons: adordd has to do some guessing
Enrico,Enrico Maria Giordano wrote:Antonio,
Please explain this point.AHF wrote:Cons: adordd has to do some guessing
EMG
Code: Select all
nrec :=recno()
seek expression with 2 fields
browse()
go to nrec //error
set index to
go to nrec //ok
browse()
hmpaquito,hmpaquito wrote:neither the first nor the second option, but both
my proposal:
basic programming: compatibility mode: 2nd option
advanced programming: 1st option. New command ADORDD_SEEK
Rick,Rick Lipkin wrote:Antonio
I use the ADO Class and methods to create recordsets to manage SQL.. and creating separate recordsets based on the primary key and the foreign key or a single recordset based on inner and outer joins.. not necessarily like we used to with .Dbf.
I am watching this thread with interest.
Rick Lipkin
Code: Select all
Func _Invoice(nRepairNumber) // 354
Local cSql,oRsInvoice,oRsInvoiceDetail,oErr
...
...
..
cSql := "Select * from [Invoice] where [Invoice Number] = "+ltrim(str(nRepairNumber))
oRsInvoice := TOleAuto():New( "ADODB.Recordset" )
oRsInvoice:CursorType := 1 // opendkeyset
oRsInvoice:CursorLocation := 3 // local cache
oRsInvoice:LockType := 3 // lockoportunistic
TRY
oRsInvoice:Open( cSQL,xCONNECT )
CATCH oErr
MsgInfo( "Error in Opening INVOICE table" )
RETURN(.F.)
END TRY
If oRsInvoice:Eof
Msginfo( "Could not find Invoice "+trim(str(nRepairNumber)) )
oRsInvoice:CLose()
oRsInvoice := nil
Return(.f.)
Endif
// open detail table
cSql := "Select * from [InvoiceDetail] where [Invoice Number] = "+ltrim(str(nRepairNumber))
oRsInvoiceDetail := TOleAuto():New( "ADODB.Recordset" )
oRsInvoiceDetail:CursorType := 1 // opendkeyset
oRsInvoiceDetail:CursorLocation := 3 // local cache
oRsInvoiceDetail:LockType := 3 // lockoportunistic
TRY
oRsInvoiceDetail:Open( cSQL,xCONNECT )
CATCH oErr
MsgInfo( "Error in Opening INVOICEDETAIL table" )
oRsInvoice:CLose()
oRsInvoice := nil
RETURN(.F.)
END TRY
Code: Select all
oRsInvoice:MoveFirst()
oRsInvoice:Find( "[InvoiceNumber] = "+ltrim+str(nRepairNumber)) )
or
oRsInvoice:Filter := "[InvoiceNumber] = "+ltrim+str(nRepairNumber))