DataContext..::.Log Property Home
This page is specific to:.NET Framework Version:3.54.0
.NET Framework Class Library
DataContext..::.Log Property

Specifies the destination to write the SQL query or command.

Namespace:  System.Data.Linq
Assembly:  System.Data.Linq (in System.Data.Linq.dll)
Syntax

'Usage

Dim instance As DataContext
Dim value As TextWriter

value = instance.Log

instance.Log = value

'Declaration

Public Property Log As TextWriter

Property Value

Type: System.IO..::.TextWriter
The TextReader to use for writing the command.
Remarks

Set this property to nullNothingnullptra null reference (Nothing in Visual Basic) to disable command logging.

Examples

The following example displays generated SQL in the console window before it displays the results of the query.

db.Log = Console.Out
Dim custQuery = _
From cust In db.Customers _
Where cust.City = "London" _
Select cust

For Each custObj In custQuery
    Console.WriteLine(custObj.ContactName)
Next


Platforms

Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Version Information

.NET Framework

Supported in: 3.5
See Also

Reference

Community Content

Error in documentation
Added by:Trifu


"Property ValueType: System.IO..::.TextWriter

The TextReader to use for writing the command. "

should be "The TextWriter to use ..."

© 2009 Microsoft Corporation. All rights reserved.   Terms of Use | Trademarks | Privacy Statement
Page view tracker
Rate the Lightweight library
x
Lightweight builds on ScriptFree (loband) by adding features you've requested: a SearchBox and default code language selection.
Do you like the SearchBox?
Do you like the tabbed code blocks?
How useful is this topic?
Tell us more.
Thanks
x
You're helping to improve MSDN Online.
Feedback
Switch View
Classic
Lightweight Beta
ScriptFree
Switch View