NET Logging Library
LogDataSet Method (Log)
Example 



KellermanSoftware.NetLoggingLibrary Namespace > Log Class : LogDataSet Method
Log a data set
Syntax
Public Shared Function LogDataSet( _
   ByVal level As LoggingLevel, _
   ByVal dataset As DataSet, _
   ByVal maxRows As Integer _
) As LogResponse
Dim level As LoggingLevel
Dim dataset As DataSet
Dim maxRows As Integer
Dim value As LogResponse
 
value = Log.LogDataSet(level, dataset, maxRows)
public static LogResponse LogDataSet( 
   LoggingLevel level,
   DataSet dataset,
   int maxRows
)
public:
static LogResponse^ LogDataSet( 
   LoggingLevel level,
   DataSet^ dataset,
   int maxRows
) 

Parameters

level
dataset
maxRows
Example
//Licensed Mode
//Log.UserName = "User Name From Receipt";
//Log.LicenseKey = "LicenseKey From Receipt";            
 
//Clear all configuration
Log.ResetConfiguration();
 
//Add a new target, you can also define targets in an xml file, app.config, or web.config
FileTarget fileTarget = new FileTarget(Environment.CurrentDirectory + "\\fileLogger.txt");
Log.Config.Targets.Add(fileTarget);
 
//Create a test DataSet
DataSet dataset = new DataSet();
 
//Create a test DataTable
DataTable table1 = new DataTable();
 
//Add columns
table1.Columns.Add("CustomerID", typeof(int));
table1.Columns.Add("CustomerName", typeof(string));
table1.Columns.Add("Country", typeof(string));
 
//Add row to table
table1.Rows.Add(new object[] { 1, "Bat Man", "England" });
table1.Rows.Add(new object[] { 2, "Cat Woman", "US" });
 
dataset.Tables.Add(table1);
 
//Create a test DataTable
DataTable table2 = new DataTable();
 
//Add columns
table2.Columns.Add("EmployeeID", typeof(int));
table2.Columns.Add("EmployeeName", typeof(string));
table2.Columns.Add("Country", typeof(string));
 
//Add row to table
table2.Rows.Add(new object[] { 1, "Employee 1", "England" });
table2.Rows.Add(new object[] { 2, "Employee 2", "US" });
 
dataset.Tables.Add(table2);
 
//Log DataSet to log
Log.LogDataSet(LoggingLevel.DEBUG, dataset, 10);
'Licensed Mode
'Log.UserName = "User Name From Receipt";
'Log.LicenseKey = "LicenseKey From Receipt";            
 
'Clear all configuration
Log.ResetConfiguration()
 
'Add a new target, you can also define targets in an xml file, app.config, or web.config
Dim fileTarget As New FileTarget(Environment.CurrentDirectory & "\fileLogger.txt")
Log.Config.Targets.Add(fileTarget)
 
'Create a test DataSet
Dim dataset As New DataSet()
 
'Create a test DataTable
Dim table1 As New DataTable()
 
'Add columns
table1.Columns.Add("CustomerID", GetType(Integer))
table1.Columns.Add("CustomerName", GetType(String))
table1.Columns.Add("Country", GetType(String))
 
'Add row to table
table1.Rows.Add(New Object() { 1, "Bat Man", "England" })
table1.Rows.Add(New Object() { 2, "Cat Woman", "US" })
 
dataset.Tables.Add(table1)
 
'Create a test DataTable
Dim table2 As New DataTable()
 
'Add columns
table2.Columns.Add("EmployeeID", GetType(Integer))
table2.Columns.Add("EmployeeName", GetType(String))
table2.Columns.Add("Country", GetType(String))
 
'Add row to table
table2.Rows.Add(New Object() { 1, "Employee 1", "England" })
table2.Rows.Add(New Object() { 2, "Employee 2", "US" })
 
dataset.Tables.Add(table2)
 
'Log DataSet to log
Log.LogDataSet(LoggingLevel.DEBUG, dataset, 10)
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

Log Class
Log Members