ironspeed

How do you see what SQL IronSpeed sends to the database?


I'm using IronSpeed Designer 12.2 and trying to write custom SQL in a WhereClause override. The custom SQL I wrote and submitted in the WhereClause is throwing an SQL exception, but I can't see the SQL IronSpeed is sending to the database. Without the SQL, I cannot troubleshoot.

I can't find where the SQL is submitted to the database, such as by an ExecuteReader method call.

I'm using a statement like this:

if (MiscUtils.IsValueSelected(this.MyFilter)) {                              
            String sql = "(EXISTS (SELECT TOP 1 CompanyId FROM Collateral as c WHERE CODE = '{0}' AND c.CompanyId = Company.CompanyId))";
            wc.iAND(String.Format(sql, this.MyFilter.SelectedValue));                
        }

I know my WhereClause SQL is correct when used outside of IronSpeed because I copy-pasted it from a query working directly in MSSQL. However I can't see how IronSpeed combines it with its internally-generated SQL after it becomes a WhereClause.

I'm hoping someone has experience with this issue and can point me in the right direction. Thanks for the help!


Solution

  • If you look for answer long enough, you can find it yourself. Here's how I found you can examine the SQL sent to the database:

    1. Go to C:\Program Files\Iron Speed\Designer v12.2.0.
    2. Copy the BaseClasses folder to the root of my IronSpeed solution folder.
    3. Add the existing BaseClasses project to the IronSpeed solution.
    4. Delete the existing references to baseclasses.dll from the projects in the IronSpeed solution (I'm using a web app rather than web site project).
    5. Add references to the BaseClasses project now included in the solution.
    6. Open the file MicrosoftDynamicSQLAdapter.vb.
    7. In method GetRecordValuesEx(...), go to line 1514 statement "reader = SqlTransaction.ExecuteReader(myCommand, cmdBehavior)" and set a breakpoint on this line.
    8. Run the project. When the breakpoint is hit, examine the command of myCommand object.