Hi friends,
First of all, I want to thank you all your help and valuable tips. We have narrowed the problem and we are very close to solve it. Remember, all except browsing features work fine with AIS over internet, with very few changes in code. This is very important and very reliable solution, with much more advantages than using Terminal Server.
Also, I want to thank Antonio for mantaining this strong and very helpfull community.
This is the sample with Carlos tip. The performance is much better than before:
// Harbour Advantage RDD sample
#include "FiveWin.ch"
#include "ads.ch"
#include "xbrowse.ch"
Request ADS,ADSKeyCount,ADSKeyNo,OrdKeyCount,OrdKeyNo, AdsGetRelKeyPos, AdsSetRelKeyPos
//----------------------------------------------------------------------------//
function Main()
local aArray := {}, cDbf, i
local nInicio, nFinal
local lCopy := .F.
// Driver CDX----------------------------------------------------------------
REQUEST DBFCDX, DBFFPT
RddRegister( "ADS", 1 )
RddSetDefault( "ADS" )
//setting up server type
// 1 = Local Server (no client / server)
// 2 = Remote Server
// 3 = Local + Remot
// 4 = Internet Server
// 5 = Local + Internet
// 6 = Remote+Internet
// 7 = Local + Remote + Internet , best choice
adsSetServerType( 4 ) // ó adsSetServerType( ADS_REMOTE_SERVER )
//setting up the file types
// 1 = DBFNTX
// 2 = DBFCDX
// 3 = ADSADI
adsSetFileType( ADS_CDX ) // o ADS_CDX
AdsRightsCheck(.F.)
IF AdsConnect60( "\\c i b er-tec.d2g.com:2000\cursos\adsdemo\cibconwn\stc\internet.add", 4,"demo","demo")
MsgInfo("Esta ahora conectado al Sevidor AIS de Cibertec en Mexico "+CRLF+CRLF+;
"You are now connected to AIS Server","Bienvenido / Welcome / Versión "+ADSVersion())
ELSE
MsgStop("Se ha rechazado la conexión al servidor AIS, por favor intente mas tarde"+CRLF+CRLF+;
"Conection to AIS Server rejected, please, try again later","AIS Error")
QUIT
ENDIF
USE CATCUE SHARED NEW ALIAS "DATOS"
DATOS->(AdsCacheRecords(50))
DATOS->(OrdSetFocus("NUMCUENTA"))
DATOS->(DBGOTOP())
sysrefresh()
Test_SQL()
DBCLOSEALL()
QUIT
return nil
//----------------------------------------------------------------------------//
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
function Test_SQL()
LOCAL cSql := ""
LOCAL aArray := {}
LOCAL cAlias := Alias()
local nInicio, nFinal
/*al inicio de la instruccion sql se define un area vacia*/
DBSelectArea(0)
/*se define instruccion sql en una cadena de texto*/
//cSql := "SELECT * FROM BIBLIO ORDER BY TITULO"
cSql := "SELECT {static} * FROM CATCUE ORDER BY DESCRIPCIO"
msgINFO(csql, "cSql")
/*crea instruccion sql y pasa los datos a tabla temporal*/
ADSCreateSQLStatement( "REPTMP", 2 )
IF ADSExecuteSQLDirect( cSql )
DBSelectArea("REPTMP")
IF LastRec() > 0 // !REPTMP->( Eof() )
/*lista resultado en tabla*/
dbgotop()
xbrowse()
ELSE
/*no se encontro datos que cumpla condicion sql*/
MsgInfo( "No se ha encontrado REGISTROS" )
ENDIF
/*cierra tabla de datos temporal*/
REPTMP->( DBCloseArea() )
ELSE
Alert( "AdsExecuteSQLDirect() failed with error "+ Str( ADSGetLastError() ) )
ENDIF
/*se selecciona area de datos anterior*/
IF !Empty(cAlias)
DBSelectArea(cAlias)
ENDIF
/*da foco al browse*/
RETURN NIL
Hope Mr. Nages and Daniel could help us with xBrowse. In this case, we will build a very easy way to enable cliente/server to our software with very very little changes.
Thanks again for this very instructive debate.
Muchas gracias. Many thanks.
Un saludo, Best regards,
Harbour 3.2.0dev, Borland C++ 5.82 y FWH 13.06 [producción]
Implementando MSVC 2010, FWH64 y ADO.
Abandonando uso xHarbour y SQLRDD.