Knight Data Access Layer
ClearLog(MemoryStream) Method
Example 




KellermanSoftware.NetDataAccessLayer Namespace > DataHelper Class > ClearLog Method : ClearLog(MemoryStream) Method
The stream to clear
Clear the memory stream
Syntax
Public Overloads Function ClearLog( _
   ByRef memoryStream As MemoryStream _
) As Boolean
Dim instance As DataHelper
Dim memoryStream As MemoryStream
Dim value As Boolean
 
value = instance.ClearLog(memoryStream)
public bool ClearLog( 
   ref MemoryStream memoryStream
)
public: bool ClearLog( 
   ref MemoryStream* memoryStream
) 
public:
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

DataHelper Class
DataHelper Members
Overload List