开发者

Debugging SQL in ASP.NET

开发者 https://www.devze.com 2022-12-11 22:36 出处:网络
private void BuildGridView2() { GridView1.DataSource = new Select() .From(\"NewsReleases\") .Where(\"RelMonth\").IsEqualTo(this.ddlAward.SelectedValue)
private void BuildGridView2()
{
    GridView1.DataSource = new Select()
    .From("NewsReleases")
    .Where("RelMonth").IsEqualTo(this.ddlAward.SelectedValue)
    .And("RelYear").IsEqualTo(this.ddlYear.SelectedValue)
    .OrderAsc("RelDate")
    .ExecuteDataSet();

 }

The SQL statement above is not working for some reason. Is there a way to write the output of the staement to to the page to see what is happening?

I tired the following but got an error:

Response.Write(
    new Select()
        .From("NewsReleases")
        .开发者_运维百科Where("RelMonth").IsEqualTo(this.ddlAward.SelectedValue)
        .And("RelYear").IsEqualTo(this.ddlYear.SelectedValue).ToString()
);


Use SQL Profiler. It allows you to see the actual SQL query being sent to the database.

It comes with SQL 2005/2008 client tools.


I'm not familiar with Subsonic, but according to this question you may be able to use the BuildSqlStatement() method of your query to see the generated SQL.

0

精彩评论

暂无评论...
验证码 换一张
取 消