expert of ADS and Harbour
Posted: Fri Mar 23, 2012 10:01 am
Hello,
Please, who are the exports of ADS and Harbour?.
Thank you.
Please, who are the exports of ADS and Harbour?.
Thank you.
www.FiveTechSoft.com
https://fivetechsoft.com/forums/
Code: Select all
// ALS connection
IF AdsConnect60( cPathLoc, ADS_LOCAL_SERVER, "ADSSYS",, 0, @nHandLoc) == .F.
nError:=AdsGetLastError(@cError)
? cError
return NIL
ENDIF
// Open a dbf
// DbUseArea( [<lNewArea>], [<cRddName>], <cDatabase>, [<cAlias>], [<lShared>], [<lReadonly>], [<cCodePage>], [<nConnection>] )
DbUseArea( .T., "ADSCDX", cPathLoc + "PRMTR.DBF", "prm_loc", .T.,,, nHandLoc )
// ADS connection
IF AdsConnect60( cPathRem, ADS_REMOTE_SERVER, "ADSSYS",, 0, @nHandRem) == .F.
nError:=AdsGetLastError(@cError)
? cError
return NIL
ENDIF
// Open a dbf
DbUseArea( .T., "ADSCDX", cPathRem + "PRMTR.DBF", "prm_rem", .T., , , nHandRem )
// Check if ADS or ALS is running
lADS := AdsConnect( cPathRem ) // -> .T.
lADS := AdsConnect( cPathLoc ) // -> .F.
Code: Select all
dbcreate( "mem:FICHA1", aEstructura , "DBFCDX" )
...
HB_DBCreateTemp( "FICHA1", aEstructura , "DBFCDX" )
Taken from the ADS help file, finally, when you open the database with the USE command, use the network drive, must be the same that setup in the ini fileThe location of the Internet-enabled Advantage Database Server must be specified. In addition, you must also configure your application to use the Advantage Internet Server server type. See Connecting Clients through the Internet to Advantage for details. Below are the three ways to specify the location of the Internet-enabled Advantage Database Server:
1. Use the server's IP address and Internet port number in the connection path string. The path can be specified as \\<ip address>:<ip port>\share\Dir\DataDictionary.add, where the <ip address> is the IP address where the Advantage Database Server is located, and the <ip port> is the Internet Port that the Advantage Database Server is listening.
Example of using the server’s IP address and Internet port number with the Advantage Client Engine API:
ulRetVal = AdsConnect60("\\\\193.69.232.1:6262\\share1\\test.add",
ADS_AIS_SERVER,
"User1",
"foobar",
ADS_DEFAULT,
&hConnect );
Similar functionality for specifying the IP address and port in the connection string/path is available in other Advantage clients. The details related to making a connection through the Internet to the Advantage Database Server from other clients can be found in the respective Advantage client Help documentation.
2. Specify the server name in the connection string. The path can be specified as \\<server name>\share\Dir\DataDictionary.add, where the <server name> is the name of a server specified in the ADS.INI file. The ADS.INI file specifies the actual IP address where the Advantage Database Server is located, and IP port that the Advantage Database Server is listening, that correspond to the specified server name. See Setting Up Your Clients Using ADS.INI for more specifics on information in the ADS.INI file.
Example of using a server name with the Advantage Client Engine API:
ulRetVal = AdsConnect60( "\\\\server1\\share1\\test.add",
ADS_AIS_SERVER,
"User1",
"foobar",
ADS_DEFAULT,
&hConnect );
3. Specify a drive letter in the connection string. The drive letter can be specified as <x:>\Dir\DataDictionary.add, where the <x:> is the name of a drive letter specified in the ADS.INI file. The ADS.INI file directly or indirectly specifies the actual IP address where the Advantage Database Server is located, as well as the IP port that the Advantage Database Server is listening, that correspond to the specified drive letter. See Setting Up Your Clients Using ADS.INI for more specifics on information in the ADS.INI file.
Example of using a drive letter with the Advantage Client Engine API:
ulRetVal = AdsConnect60( "x:\\test.add",
ADS_AIS_SERVER,
"User1",
"foobar",
ADS_DEFAULT,
&hConnect );
The Advantage Internet Server configuration can be specified in the ADS.INI file by adding a couple of sections.
The [Drives] section lists the complete UNC path to which a drive letter is mapped. If your client application uses drive letters, you will need to define the drive letter mappings.
Example:
[ Drives ]
R:=\\SERVER1\SHARE
For each Advantage Database Server you want to connect to, you will need to have a separate server-name entry.
Example:
[ <server name> ]
INTERNET_PORT=<the Internet port for the server>
INTERNET_IP=<the IP address for the Advantage Database Server>
Example:
[Drives]
Q:=\\serverA\testsys\
r:=\\serverB\data\
[serverA]
INTERNET_PORT=2001
INTERNET_IP=198.169.1.69
[serverB]
INTERNET_PORT=2002
INTERNET_IP=198.70.169.72
Code: Select all
#include "ads.ch"
#define CRLF Chr(13)+Chr(10)
Request ADS,ADSKeyCount,ADSKeyNo,OrdKeyCount,OrdKeyNo,
AdsGetRelKeyPos, AdsSetRelKeyPos
//----------------------------------------------------------------------------//
function Main()
local aArray := {}, cDbf, i
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 )
AdsRightsCheck(.F.)
IF AdsConnect60( "\\194.224.200.2:2400\lucas\lucas.ADD",
4 ,"massimo","")
// MsgInfo("Esta ahora conectado al Sevidor AIS "+CRLF+CRLF+;
// "You are now connected to AIS Server","Bienvenido /
Welcome / Versión "+ADSVersion())
ELSE
alert("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")
alert( "Error:"+cValtochar( AdsGetLastError() )+CRLF +;
"Servidor:", "Usuario" )
QUIT
ENDIF
i := dbCreate( ("\\194.224.200.2:2400\LUCAS\MASSIMO"),
{ { "FNUMERO" , "N", 20, 0 }, ;
{ "FCODIGO" , "C", 20, 0 }, ;
{ "FPARCIAL2" , "N", 24, 10 } } )
Alert(i) // I GET .T.
use \\194.224.200.2:2400\LUCAS\MASSIMO.DBF new
// i get ADSCDX/5132 The specified database object name is not
valid.: \\194.224.200.2:2400\LUCAS\MASSIMO
browse()
alert(AdsDeleteFile("\\194.224.200.2:2400\LUCAS\MASSIMO.dbf") ) //
I GET .T.
alert(AdsDeleteFile("c:\lucas\oterfile.dbf") ) // I GET .T.
dbcloseall()
quit
return nil
Code: Select all
cSQL := "CREATE INDEX index1 ON table1 ( field1 ); " + CRLF +;
"CREATE INDEX index2 ON table1 ( field2, field3 ); "
...
IF AdsCreateSQLStatement( cAlias, ADS_ADT, hADSConnection )
IF (lOK := ADSExecuteSQLDirect( cSQL ) )
...
ENDIF
ENDIF
...
Code: Select all
// Todas las series
INDEX ON FIELD->FSERIE + StrZero (FIELD->FNUMERO,20 ) TO FACTUR1 FOR !Deleted()
// Serie A, B y R
INDEX ON FIELD->FSERIE + StrZero (FIELD->FNUMERO,20 ) TO FACTUR2 FOR FIELD->FSERIE="A" .AND. !Deleted()
INDEX ON FIELD->FSERIE + StrZero (FIELD->FNUMERO,20 ) TO FACTUR3 FOR FIELD->FSERIE="B" .AND. !Deleted()
INDEX ON FIELD->FSERIE + StrZero (FIELD->FNUMERO,20 ) TO FACTUR4 FOR FIELD->FSERIE="R" .AND. !Deleted()
// Cobrada
INDEX ON FIELD->FSERIE + StrZero (FIELD->FNUMERO,20 ) TO FACTUR5 FOR FIELD->FCOBRADA="S" .AND. !Deleted()
INDEX ON FIELD->FSERIE + StrZero (FIELD->FNUMERO,20 ) TO FACTUR6 FOR FIELD->FCOBRADA!="S" .AND. !Deleted()
DbCloseAll()