Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Unable to ExecScript() COPY TO if data adapter not close
Message
De
12/02/2007 08:11:25
Alexandre Palma
Harms Software, Inc.
Alverca, Portugal
 
 
À
26/01/2007 15:37:20
Information générale
Forum:
ASP.NET
Catégorie:
Bases de données
Versions des environnements
Environment:
VB 8.0
OS:
Windows XP SP2
Database:
Visual FoxPro
Divers
Thread ID:
01189785
Message ID:
01194690
Vues:
8
Michel I would say that since you always using the same connection the table is already open, my guess is to do something like
IF !USED(table name)
USE table name in 0
ENDIF
Also why don't you have only one execscript with all the statements?
you could use a string builder to build the VFP commands adding vbCRLF to the end of each line and then do something like
loDataProviderBackup.CommandTextAdd("EXECSCRIPT([" & stringbuilder.tostring & "])")
This should be more efficient.

>I am unable to execute the VFP ExecScript() COPY TO command on a VFP table if a data adapter connection is opened using the table. In the following code, I am issuing SET SAFETY OFF and SET EXCLUSIVE OFF before doing the COPY TO:
>
>
>            loDataProviderBackup.CommandTextAdd("EXECSCRIPT(""SET SAFETY OFF"")")
>            loDataProviderBackup.CommandTextAdd("EXECSCRIPT(""SET EXCLUSIVE OFF"")")
>            loDataProviderBackup.CommandTextAdd("EXECSCRIPT(""USE " + lcTable + """)")
>            loDataProviderBackup.CommandTextAdd("EXECSCRIPT(""COPY TO '" + lcDirectory + lcTable + "'"")")
>            loDataProviderBackup.CommandTextAdd("EXECSCRIPT(""USE"")")
>
>            ' Index
>            If Not loDataProviderBackup.ExecuteNonQuery() Then
>                Return False
>            End If
>
>
>But, if I have another data provider object having a connection opened on a table that I need to copy, I have a "File is in use" error.
>
>Anyone has a better approach to backup a VFP table from .NET where I would avoid the "File is in use" error message?
Alexandre Palma
Senior Application Architect
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform