IF lOK = .F.
ELSE
oDLG := NIL
SysReFresh()
lOK1 := .F.
// re open a new recordset
DEFINE DIALOG oDlg ;
FROM 5, 8 to 10, 75 ;
TITLE "Please be patient " ;
STYLE nOr( WS_POPUP,WS_CAPTION,WS_THICKFRAME ) TRANSPARENT
cSAY := "Opening Initial TRIPS Data Recordset for Motorpool "+alltrim( xPOOL )
@ 1,10 SAY oSay var cSAY of oDLG
oDLG:bStart := { | | lOK1 := _OpenUm(oDlg ) }
ACTIVATE DIALOG oDLG CENTERED ;
ON PAINT GradientFill( hDC, 0, 0, odlg:nHeight, odlg:nWidth, xGrad1, .T. )
IF lOK1 = .F.
SysReFresh()
RETURN(.F.)
ENDIF
// here was the solution //
oBrw:oRs:= oRsTrip
oBrw:ReFresh()
SysReFresh()
ENDIF
oBrw:ReFresh()
SysReFresh()
xTITLE := "TRIPS Records Browse for Agency\Motorpool "+ALLTRIM(xAGENCY)+"\"+ALLTRIM(xPOOL)
oEMP:cTITLE(xTITLE)
oEMP:ReFresh()
SysReFresh()
RETURN( .T. )
STATIC FUNCTION FilHdr(nAmo,oBrw,aGets)
oRsHdr:Close()
oRsHdr:Source := "SELECT " +;
"hdrfac.*," +;
"cliente.cli_nom " +;
"FROM " +;
"hdrfac," +;
"cliente " +;
"WHERE " +;
"hdrfac.hdr_cli = cliente.cli_cli " +;
"AND " +;
"YEAR(HDR_FDE) = '" + STR(nAmo,4,0) + "' " +;
"ORDER BY " +;
"hdr_fac"
oRsHdr:Open()
oRsHdr:Refresh()
oBrw:Refresh()
aGets[1]:oJump := oBrw
RETURN(.T.)
// here was the solution //
oBrw:oRs:= oRsTrip
// These are redundant since they are executed
// right after the ENDIF
// oBrw:ReFresh()
// SysReFresh()
ENDIF
oBrw:ReFresh()
SysReFresh()
IF lOK = .F.
ELSE
oDLG := NIL
SysReFresh()
lOK1 := .F.
// re open a new recordset
DEFINE DIALOG oDlg ;
FROM 5, 8 to 10, 75 ;
TITLE "Please be patient " ;
STYLE nOr( WS_POPUP,WS_CAPTION,WS_THICKFRAME ) TRANSPARENT
cSAY := "Opening Initial TRIPS Data Recordset for Motorpool "+alltrim( xPOOL )
@ 1,10 SAY oSay var cSAY of oDLG
oDLG:bStart := { | | lOK1 := _OpenUm(oDlg ) }
ACTIVATE DIALOG oDLG CENTERED ;
ON PAINT GradientFill( hDC, 0, 0, odlg:nHeight, odlg:nWidth, xGrad1, .T. )
IF lOK1 = .F.
SysReFresh()
RETURN(.F.)
ENDIF
* oBrw:oRs:= oRsTrip // this does work
oRsTrip:Refresh() // does not work
oBrw:ReFresh()
SysReFresh()
ENDIF
oBrw:ReFresh()
SysReFresh()
xTITLE := "TRIPS Records Browse for Agency\Motorpool "+ALLTRIM(xAGENCY)+"\"+ALLTRIM(xPOOL)
oEMP:cTITLE(xTITLE)
oEMP:ReFresh()
SysReFresh()
RETURN( .T. )
oRsHdr:CursorLocation := adUseClient
oRsHdr:LockType := adLockOptimistic
oRsHdr:CursorType := adOpenDynamic
oRsHdr:Source := "SELECT " +;
"hdrfac.*," +;
"cliente.cli_nom " +;
"FROM " +;
"hdrfac," +;
"cliente " +;
"WHERE " +;
"hdrfac.hdr_cli = cliente.cli_cli " +;
"AND " +;
"YEAR(HDR_FDE) = '" + STR(nAmo,4,0) + "' " +;
"ORDER BY " +;
"hdr_fac"
REDEFINE GET aGets[ 1] VAR nAmo ID 101 OF oDlg UPDATE;
PICTURE "9999" SPINNER;
ON CHANGE (FilHdr(nAmo,oBrw,aGets),oBrw:SetFocus(),oBrw:GoTop(),oDlg:UPDATE());
MESSAGE "Año de las facturas a mostrar"
STATIC FUNCTION FilHdr(nAmo,oBrw,aGets)
oRsHdr:Close()
oRsHdr:Source := "SELECT " +;
"hdrfac.*," +;
"cliente.cli_nom " +;
"FROM " +;
"hdrfac," +;
"cliente " +;
"WHERE " +;
"hdrfac.hdr_cli = cliente.cli_cli " +;
"AND " +;
"YEAR(HDR_FDE) = '" + STR(nAmo,4,0) + "' " +;
"ORDER BY " +;
"hdr_fac"
oRsHdr:Open()
oRsHdr:Refresh()
oBrw:Refresh()
aGets[1]:oJump := oBrw
RETURN(.T.)
James Bott wrote:Rao,
Well, that would explain it. Apparently, Armando is not using ADO.
However, shouldn't oRS:refresh() error out if that method doesn't exist?
James
This syntax is OK; it is the same as oBrw:setADO( oRS )
Note that a recordset is not an alias. There is no alias used when using a recordset. In TWbrowse you had to set cAlias to nil to prevent it erroring--this was really a workaround for a bug.
#include 'fivewin.ch'
#include 'xbrowse.ch'
#define FWPATH "c:\fwh\samples\"
static oCn
function Main()
local cStr := "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + ;
FWPATH + ;
";Extended Properties=dBASE III;User ID=Admin;Password=;"
local cSql := 'SELECT FIRST,CITY,STATE FROM CUSTOMER WHERE STATE = "?" ORDER BY FIRST'
local oDlg, oBrw, oRs
local cState := 'NY'
oCn := TOleAuto():New( "ADODB.Connection" )
oCn:Open( cStr )
oCn:CursorLocation := 3 // adUseClient
oRs := TOleAuto():New( "ADODB.RecordSet" )
oRs:Open( StrTran( cSql, '?', cState ), oCn )
DEFINE DIALOG oDlg SIZE 600,400 PIXEL
@ 30,10 XBROWSE oBrw SIZE -10,-10 PIXEL OF oDlg ;
AUTOCOLS AUTOSORT RECORDSET oRs ;
CELL LINES NOBORDER
oBrw:CreateFromCode()
@ 10,240 COMBOBOX cState ITEMS { "AK", "AL", "AR", "AZ", "CA", "DA", "GE", "HI", "NY" } ;
SIZE 50,100 PIXEL OF oDlg ;
ON CHANGE ( ;
oBrw:oRs:Close(), ;
oBrw:oRs:Open( StrTran( cSql, "?", cState ), oCn ), ;
oBrw:GoTop(), oBrw:Refresh(), oBrw:SetFocus() )
ACTIVATE DIALOG oDlg CENTERED ON INIT ( oBrw:SetFocus(), .f. )
return nil
Armando wrote:James:
Yes, I'm using ADO, xHarbour, MySql & FWH810. And not problem at all with
oRsHdr:Refresh()
Regards
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: Google [Bot] and 47 guests