Jump to content

Deletar registros e usar PACK.


Clodoaldo Monteiro

Recommended Posts

Olá!

Estou conectando a uma tabela DBF com o drive VFPOLEDB, para excluir determinados registros e até aí tudo bem, mas quando tendo executar o comando PACK, para uma exclusão definitiva, o object connect retorna erro, alegando não ter exclusividade para executar o PACK.Assim faço a conexão:

   cnConnection := CreateObject( "ADODB.Connection" )
   cnConnection:ConnectionString := ;
    "Provider=VFPOLEDB.1" +;
    ";Data Source=" + cPath  +;
    ";Exclusive=Yes" +;
    ";Collating Sequence=general" //=Machine ou  =general
   cnConnection:CursorLocation  := AD_USE_CLIENT
   cnConnection:CommandTimeOut  := 600
   cnConnection:ConnectionTimeOut := 600
   cnConnection:open()

Executa as exclusões:

     mSQL := "Delete FROM Dia"
      mSQL += " Where dia_tl = 'A' AND dia_mm = '" + pe_mm + "';"
      oCommand := CreateObject("ADODB.Command")
      oCommand:ActiveConnection := oCnVfp
      oCommand:CommandText := mSQL
      oCommand:Execute()

Aqui tento fazer o PACK:

      mQuery := "PACK"
      oCommand:CommandText := mQuery
      oCommand:Execute()

Descrição do erro: "File must be opened exclusively"

Desde já, agradeço a ajuda.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.