Knight Data Access Layer
ClearLog(String) Method
Example 




KellermanSoftware.NetDataAccessLayer Namespace > IDataHelper Interface > ClearLog Method : ClearLog(String) Method
The full path to the file
Clear the file log
Syntax
Overloads Function ClearLog( _
   ByVal filePath As String _
) As Boolean
Dim instance As IDataHelper
Dim filePath As String
Dim value As Boolean
 
value = instance.ClearLog(filePath)
bool ClearLog( 
   string filePath
)
bool ClearLog( 
   string* filePath
) 
bool ClearLog( 
   String^ filePath
) 

Parameters

filePath
The full path to the file
Example
string filePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "log.txt");
 
//Get the current thread static safe instance of the helper
IDataHelper db = DataHelper.SessionFactory();
 
//Specify User Name and License Key from the receipt, leave blank for trial mode
//db.UserName = "John Smith 1234";
//db.LicenseKey = "asdfl219==";
 
//Log to a file
db.EnableLogging(filePath);
 
//Open the database connection
db.OpenConnection();
 
//Create a new Person to save to the database
Person currentPerson = new Person();
currentPerson.FirstName = "John";
currentPerson.LastName = "Smith";
 
//Save it to the database 
db.Save(currentPerson);
 
//This will be true
Console.WriteLine(File.Exists(filePath));
 
//Clear it
db.ClearLog(filePath);
 
//This will be false
Console.WriteLine(File.Exists(filePath));
 
//Close the connection
db.CloseConnection();
Dim filePath As String = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "log.txt")
 
'Get the current thread static safe instance of the helper
Dim db As IDataHelper = DataHelper.SessionFactory()
 
'Specify User Name and License Key from the receipt, leave blank for trial mode
'db.UserName = "John Smith 1234"
'db.LicenseKey = "asdfl219=="
 
'Log to a file
db.EnableLogging(filePath)
 
'Open the database connection
db.OpenConnection()
 
'Create a new Person to save to the database
Dim currentPerson As New Person()
currentPerson.FirstName = "John"
currentPerson.LastName = "Smith"
 
'Save it to the database 
db.Save(currentPerson)
 
'This will be true
Console.WriteLine(File.Exists(filePath))
 
'Clear it
db.ClearLog(filePath)
 
'This will be false
Console.WriteLine(File.Exists(filePath))
 
'Close the connection
db.CloseConnection()
Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

IDataHelper Interface
IDataHelper Members
Overload List