Hallo,
kurze Frage.
In
strwLog
steht erst was drin, wenn das
frmR1.DataSource = qry1;
ausgeführt wurde.
Kann jemand eine Erklärung abgeben?
Es muss ja dann eine Referenz sein, es gibt sonst keine weitere Zuweisung.
Grüße Oliver
var qry2 = _Db.CountryRegions
.Join(_Db.StateProvinces,
cr => cr.CountryRegionCode,
sp => sp.CountryRegionCode,
(cr, sp) => new
{
cr.CountryRegionCode,
CountryRegionName = cr.Name,
sp.StateProvinceCode,
StateProvinceName = sp.Name
})
.OrderBy(cr => cr.CountryRegionName)
.ThenBy(sp => sp.StateProvinceName);
StringBuilder strb = new StringBuilder();
StringWriter strwLog = new StringWriter(strb);
_Db.Log = strwLog;
FrmResultGrid frmR1 = new FrmResultGrid();
frmR1.DataSource = qry1;
frmR1.Show();
public partial class FrmResultGrid : Form
{
public object DataSource
{
set
{
dgvResult.Rows.Clear();
dgvResult.DataSource = value;
}
}
public string FormTitle
{
set
{
this.Text = "Result: " + value;
}
}
public FrmResultGrid()
{
InitializeComponent();
}
}
.....
// Zusammenfassung:
// Represents the main entry point for the LINQ to SQL framework.
public class DataContext : IDisposable
{
public DataContext(string fileOrServerOrConnection);
//
// Zusammenfassung:
// Gets or sets the System.Data.Linq.DataLoadOptions associated with this System.Data.Linq.DataContext.
//
// Rückgabewerte:
// The prefetch load options for related data.
public DataLoadOptions LoadOptions { get; set; }
//
// Zusammenfassung:
// Specifies the destination to write the SQL query or command.
//
// Rückgabewerte:
// The System.IO.TextReader to use for writing the command.
public TextWriter Log { get; set; }