Menu

Set global data path

2008-08-09
2012-12-07
  • Nobody/Anonymous

    Is there a way to set the default data path to create/open databases ?

    I mean to change this code:

    LOCAL cServer:="//127.0.0.1:2812", nI

    IF Leto_Connect(cServer)==-1
       DBCreate(cServer+"Test", ;
         {{"field1","N", 3,0},;
         {"field2","c", 25,0} })
       DBUseArea(.T.,,cServer+"Prueba1","Prueba1")
    ENDIF

    To something like this:

    LOCAL cServer:="//127.0.0.1:2812", nI

    IF Leto_Connect(cServer)==-1
       DBCreate( "Test", ;
         {{"field1","N", 3,0},;
         {"field2","c", 25,0} })
       DBUseArea(.T.,,"Prueba1","Prueba1")
    ENDIF

    This way we don't need to add cServer in each call to DBCreate, DBUseArea, etc.

    Regards.

     
    • Alexander S.Kresin

      Yes, the standard:

      LOCAL cServer:="//127.0.0.1:2812"

      SET PATH TO &cServer
      SET DEFAULT TO &cServer

       

Log in to post a comment.