Knight Data Access Layer
ClearLog(MemoryStream) Method
Example 




KellermanSoftware.NetDataAccessLayer Namespace > IDataHelper Interface > ClearLog Method : ClearLog(MemoryStream) Method
The stream to clear
Clear the memory stream
Syntax
Overloads Function ClearLog( _
   ByRef memoryStream As MemoryStream _
) As Boolean
Dim instance As IDataHelper
Dim memoryStream As MemoryStream
Dim value As Boolean
 
value = instance.ClearLog(memoryStream)
bool ClearLog( 
   ref MemoryStream memoryStream
)
bool ClearLog( 
   ref MemoryStream* memoryStream
) 
bool ClearLog( 
   MemoryStream^% memoryStream
) 

Parameters

memoryStream
The stream to clear
Example
//Create a new memory stream
MemoryStream memStream = new MemoryStream();
 
//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 memory stream
db.EnableLogging(ref memStream);
 
//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);
 
//Clear the memory stream
db.ClearLog(ref memStream);
 
//This will be zero
Console.WriteLine(memStream.Length);
 
//Close the connection
db.CloseConnection();
'Create a new memory stream
Dim memStream As New MemoryStream()
 
'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 memory stream
db.EnableLogging(memStream)
 
'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)
 
'Clear the memory stream
db.ClearLog(memStream)
 
'This will be zero
Console.WriteLine(memStream.Length)
 
'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