Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4274472
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T07:51:06+00:00 2026-05-21T07:51:06+00:00

Using Visual Studio 2010, .NET 4 as a Console App. With a breakpoint on

  • 0

Using Visual Studio 2010, .NET 4 as a Console App.

With a breakpoint on the close of the using statement, Visual Studio shows the select statement when hovering over “stuff”. However, “stmt1” and “stmt2” are both empty. Why?

Thanks.

Console app:

using ( var cona = new mydbcontext(connstring) )
    {
        var stuff = from a in cona.testtable select a;
        var stmt1 = cona.SqlStatement;
        string stmt2 = cona.GetLoggedInformation();
    }

and

public partial class mydbcontext : DataContext
{
    private StringBuilder bldr = new StringBuilder();
    partial void OnCreated()
    {
        this.CommandTimeout = 120;
        this.Log = new StringWriter(bldr);
    }
    public String GetLoggedInformation()
    {
        return bldr.ToString();
    }
    public string SqlStatement
    {
        get { return this.bldr.ToString(); }
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T07:51:07+00:00Added an answer on May 21, 2026 at 7:51 am

    Most likely, the log is not written until the statement is executed.

    Try this

    using ( var cona = new mydbcontext(connstring) )
    {
        var stuff = from a in cona.testtable select a;
        var data = stuff.ToList();
        var stmt1 = cona.SqlStatement;
        string stmt2 = cona.GetLoggedInformation();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Consider the following code (written with Visual Studio 2010 and .NET 4.0) using System;
I'm trying to debug .NET Framework's source code using Visual Studio 2010 Professional. I
Guys I created a console application in Visual Studio 2010. It targets the .NET
I am using Visual Studio 2010, C# .NET 4.0. I have 3 forms: Form1,
I'm going to be building some ASP.Net MVC 2 software using Visual Studio 2010
Using Visual Studio 2010 .Net Framework 4 C# Linq to Entities Issue I would
I'm using visual studio 2010 and vb.net. On my form I have an Group
I've created a windows service application using Visual Studio .NET 2010 and C#. I've
I'm creating an application in C# using Visual Studio 2010/.NET 4.0. For part of
Using VB.NET in Visual Studio 2010, I have two files: test2.aspx and test2.aspx.vb. The

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.