Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Set safety
Message
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Title:
Environment versions
Environment:
VB 9.0
OS:
Vista
Network:
Windows 2008 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01356988
Message ID:
01357010
Views:
14
>>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. :)
Previous
Reply
Map
View

Click here to load this message in the networking platform