Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Set safety
Message
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Titre:
Versions des environnements
Environment:
VB 9.0
OS:
Vista
Network:
Windows 2008 Server
Database:
MS SQL Server
Divers
Thread ID:
01356988
Message ID:
01357010
Vues:
15
>>In VFP there is a command SET SAFETY OFF that will allow you to overwrite an existing file without throwing an error or exception. Is there an equivalent in .NET VB?
>>
>>Thanks
>
>It depends. How are you writing this information to an existing file?
>
>For example, if you are copying a file:
>
>
>System.IO.File.Copy(source, dest, true); // third param. tells it to overwrite
>
>
>In other cases, you may need to delete the file first.
>
>
>System.IO.File.Delete(file);
>
>
>And there are other classes which overwrite by default.
>
>
>System.IO.File.WriteAllText(path, textToWrite);
>
Thanks Paul and Naomi. After I posted the question I realized I should have been more specific. The "file" in question is a table inside an Access MDB. I am writing via a select as in
strSQL = "SELECT FirstName, SecondName INTO [tblSample] FROM [Text;DATABASE=" & Path & ";].[test.txt]"
This will work the first time through when the table doesn't exist but throws an error if the table is already there.
If its already present I can DELETE and INSERT into it but then I have to test to see if its there. :)
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform