how open database INTERNET VIA ADO ?

how open database INTERNET VIA ADO ?

Postby mauricioajordao » Sun Mar 05, 2006 10:11 pm

how open database INTERNET VIA ADO ?



thanks everybody..

mauricio
mauricioajordao
 
Posts: 78
Joined: Fri Dec 02, 2005 6:55 pm
Location: brazil

Postby R.F. » Sun Mar 05, 2006 11:27 pm

In order to conect a remote dabase you only need to know the IP address of the remote server. Also you may need to cofigure the remote server to open and forward the needed ports in the router. In your source code, just change the String connection with the correct IP:

Let`s asume for these samples that the IP Address in the remote server over internet is 200.67.137.11

For SQL Server, the string connection should look like this
"provider=SQLOLEDB;server=200.67.137.11;database=SISTEMAS;uid=jorge;pwd=jcm"

For Advantage Databas Server:
"Provider=Advantage.OLEDB.1;User ID=adssys;Data Source= \\200.67.137.11:2001\fwapps\klm\agentperformance.add;Persist Security Info=False;ServerType=ADS_INTERNETL_SERVER"

For MySQL:
"DRIVER={MySQL ODBC 3.51 Driver}; SERVER=200.67.137.11; DATABASE=garis;UID=root;PWD=18167231"

All the rest remains the same, not need to change anything in your source code (ADO rules :-) ).

In some cases, if you have Internet Name Resolution available in the client machine, you may use a Domain name instead of the IP address, this is very useful if you don't have a fixed IP, for these you may use services as www.dns2go.com or www.noip.com
Saludos
R.F.
R.F.
 
Posts: 840
Joined: Thu Oct 13, 2005 7:05 pm

Postby mauricioajordao » Mon Mar 06, 2006 9:07 am

thanks renee

but Where can Find Strings for ConneCCtion. ?




Thanks Again..
mauricioajordao
 
Posts: 78
Joined: Fri Dec 02, 2005 6:55 pm
Location: brazil


Postby mauricioajordao » Mon Mar 06, 2006 5:51 pm

thanks for help me , my friends..


But My problem Now is Other..


What the Better Class "LISTBOX" to change ADO Connection. ?


Thanks Again
mauricioajordao
 
Posts: 78
Joined: Fri Dec 02, 2005 6:55 pm
Location: brazil

Postby Enrico Maria Giordano » Mon Mar 06, 2006 6:57 pm

To change?

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8718
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby mauricioajordao » Mon Mar 06, 2006 7:06 pm

I Try TCBROWSE bUT I HAVE Change TWBROWSE too...
mauricioajordao
 
Posts: 78
Joined: Fri Dec 02, 2005 6:55 pm
Location: brazil

Postby Enrico Maria Giordano » Mon Mar 06, 2006 7:35 pm

You can use whatever browse you want.

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8718
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby mauricioajordao » Mon Mar 06, 2006 8:18 pm

how using whatever browse ?



thanks enrico
mauricioajordao
 
Posts: 78
Joined: Fri Dec 02, 2005 6:55 pm
Location: brazil

Postby Enrico Maria Giordano » Mon Mar 06, 2006 8:58 pm

This is a sample with MSDE using TWBrowse and TCBrowse:

Code: Select all  Expand view  RUN
#include "Fivewin.ch"
#include "Tcbrowse.ch"


FUNCTION MAIN()

    LOCAL oRs, oErr

    oRs = CREATEOBJECT( "ADODB.Recordset" )

    TRY
        oRs:Open( "SELECT * FROM T_Utenti ORDER BY Utente", "Provider=SQLOLEDB;Integrated Security=SSPI;Data Source=EMAG\Emag;Initial Catalog=Quadro", 1, 3 )
    CATCH oErr
        ? oErr:Description
        RETURN NIL
    END TRY

    WBROWSERECORDSET( oRs )
    TCBROWSERECORDSET( oRs )

    oRs:Close()

    RETURN NIL


STATIC FUNCTION WBROWSERECORDSET( oRs )

    LOCAL oDlg, oBrw

    DEFINE DIALOG oDlg SIZE 300, 300

    @ 0, 0 LISTBOX oBrw FIELDS oRs:Fields( "Utente" ):Value;
           HEADERS "UTENTI";
           ON RIGHT CLICK oBrw:Report( "TWBrowse report", .T. )

    oBrw:bLogicLen = { || oRs:RecordCount }
    oBrw:bGoTop    = { || oRs:MoveFirst() }
    oBrw:bGoBottom = { || oRs:MoveLast() }
    oBrw:bSkip     = { | nSkip | Skipper( oRs, nSkip ) }
    oBrw:cAlias    = "ARRAY"

    ACTIVATE DIALOG oDlg;
             ON INIT oDlg:SetControl( oBrw );
             CENTER

    RETURN NIL


STATIC FUNCTION TCBROWSERECORDSET( oRs )

    LOCAL oDlg, oBrw, oCol

    DEFINE DIALOG oDlg SIZE 300, 300

    @ 0, 0 BROWSE oBrw;
           ON RIGHT CLICK oBrw:Report( "TCBrowse report", .T. )

    ADD COLUMN TO oBrw;
               DATA oRs:Fields( "Utente" ):Value;
               HEADER "UTENTI";
               COLOR CLR_RED, CLR_GREEN

    ADD COLUMN TO oBrw;
               DATA oRs:Fields( "Utente" ):Value;
               HEADER "UTENTI";
               COLOR CLR_RED, CLR_GREEN

    oBrw:lCellStyle = .T.

    oBrw:bLogicLen = { || oRs:RecordCount }
    oBrw:bGoTop    = { || oRs:MoveFirst() }
    oBrw:bGoBottom = { || oRs:MoveLast() }
    oBrw:bSkip     = { | nSkip | Skipper( oRs, nSkip ) }
    oBrw:cAlias    = "ARRAY"

    ACTIVATE DIALOG oDlg;
             ON INIT oDlg:SetControl( oBrw );
             CENTER

    RETURN NIL


STATIC FUNCTION SKIPPER( oRs, nSkip )

    LOCAL nRec := oRs:AbsolutePosition

    oRs:Move( nSkip )

    IF oRs:EOF; oRs:MoveLast(); ENDIF
    IF oRs:BOF; oRs:MoveFirst(); ENDIF

    RETURN oRs:AbsolutePosition - nRec


EMG
User avatar
Enrico Maria Giordano
 
Posts: 8718
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby mauricioajordao » Mon Mar 06, 2006 9:14 pm

thanks enrico
mauricioajordao
 
Posts: 78
Joined: Fri Dec 02, 2005 6:55 pm
Location: brazil

Postby mauricioajordao » Tue Mar 07, 2006 1:42 pm

Thanks Enrico..


When I Insert new ReC IN TABLE , THE REGISTRY DON´T POSITION FOR BY ORDER ..

DO YOU KNOW ABOUT THIS?

I´M USING


::ADDNEW()
::alias:fields(value1):value := value2
::UPDATE()

BUT THE NEW REGISTRY DON´T CONRRECT POSITION BY ORDER;..


THANKS AGAIN ,
MAURICIO (BRASIL)
mauricioajordao
 
Posts: 78
Joined: Fri Dec 02, 2005 6:55 pm
Location: brazil

Postby Enrico Maria Giordano » Tue Mar 07, 2006 2:16 pm

You have to use Requery() method followed by Find() method (to reposition the record pointer on the right record).

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8718
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby mauricioajordao » Tue Mar 07, 2006 3:03 pm

i will try

thanks enrico
mauricioajordao
 
Posts: 78
Joined: Fri Dec 02, 2005 6:55 pm
Location: brazil

Postby mauricioajordao » Tue Mar 07, 2006 5:57 pm

thanks thanks , enrico ..

Your Help are very help me...


If tou permission only Ask ...

You Can Explain me As Delete Records and Align by order ?


Thanks Again
mauricioajordao
 
Posts: 78
Joined: Fri Dec 02, 2005 6:55 pm
Location: brazil

Next

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 44 guests