Thursday, May 17, 2007

SQL Reporting Service could get a little bit frustrated. (Invalid Object about temporary table.)


I am starting to use the SQL reporting service to generate a couple of reports for the project I am working on right now, and it could get a little bit frustrated for a newbie.


In my process, I need to generate a report based on a stored procedure.


Then, I got the following error which complains that the temporary table is invalid.

What you can do, the temporary table should be perfectly fine in the stored procedure. I just clicked OK.


Since the dataset was not generated successfully, it won’t automatically generate a list of report parameters for you.



The good thing is that unlike Crystal report which the underlying format is in binary, sql report is all xml based, which gives a lot of flexibility in editing the report manually.


You can simply manually add a list of report parameters like this in the rdl file (open it in any text editing software).


<ReportParameters>

<ReportParameter Name="countyID">

<DataType>String</DataType>

<DefaultValue>

<Values>

<Value>e12b5415-de73-4751-b2cb-2e98740c4460</Value>

</Values>

</DefaultValue>

<Prompt>County ID</Prompt>

</ReportParameter>

<--- other report parameters>

</ReportParameters>


This will generate a list of report parameters


But how do you pass those reporting parameters to the sql query parameters. If you put a table control on the report, and set the underlying data source to the previous dataset, and try to preview it. It will give you another error like this:




There are two ways to address this issue:

  1. one way is that you go back to the dataset, set the Parameters manually there.

  1. The other option is that you can still edit in the xml file, which is the way I preferred. Under the DataSets, looking for the DataSet interested, and set the QueryParameters there…

<DataSets>

<DataSet Name="ComplianceMissing">

<Query>

<DataSourceName>EarlyTrack</DataSourceName>

<CommandType>StoredProcedure</CommandType>

<CommandText>rptGetComplianceMissingChild</CommandText>

<QueryParameters>

<QueryParameter Name="@countyID">

</QueryParameter>

</QueryParameters>

</Query>

</DataSet>

</DataSets>



The whole process is not that trival…

Integrate Visual Studio 2003 with the Team Foundation Server Process


The Team foundation server is release by Microsoft after Visual studio 2003, so the visual studio 2003 has to go through a couple of manual configuration process to be able to work with Team Foundation Server.


  1. Download “Visual Studio 2005 Team Foundation Server MSSCCI Provider” from Microsoft Website. (The download link could change in the future, it’s best to download a copy and store it on some place on the server).

  2. The prerequisite to this installation is that you must already have:

    1. Visual Studio 2005 Team Foundation Server

    2. Visual Studio 2005 Team Explorer

    3. .NET Framework 2.0


If you already work with Team Foundation Server with the Visual Studio 2005, you should already have those program installed.


  1. To add an existing project to the Team Foundation Server, Right Click the Solution you want to add to the Team Foundation Server, and click “Add solution to source control”.


  1. Select the Tfs server you want to connect to: (If it’s the first time you connect to the Tfs server, you have to type in the Tfs server name you want to connect to.)


  1. Add the project to the Tfs Server.


  1. After adding the project, you can see all the icons turned to “checked in” status.

  1. You can also go to File -> Source Control to add an existing project to the solution.

Saturday, May 05, 2007

What Http Modules are configured in the machine.config .

I am looking into an issue what happens if you forgot to put any session configuration in the web.config file. The session state is one of the http modules configured in the machine.config file, there are a few besides the session state module. The following is what I found in my machine.config file.


<httpModules>
<add name="OutputCache" type="System.Web.Caching.OutputCacheModule" />
<add name="Session" type="System.Web.SessionState.SessionStateModule" />
<add name="WindowsAuthentication" type="System.Web.Security.WindowsAuthenticationModule" />
<add name="FormsAuthentication" type="System.Web.Security.FormsAuthenticationModule" />
<add name="PassportAuthentication" type="System.Web.Security.PassportAuthenticationModule" />
<add name="RoleManager" type="System.Web.Security.RoleManagerModule" />
<add name="UrlAuthorization" type="System.Web.Security.UrlAuthorizationModule" />
<add name="FileAuthorization" type="System.Web.Security.FileAuthorizationModule" />
<add name="AnonymousIdentification" type="System.Web.Security.AnonymousIdentificationModule" />
<add name="Profile" type="System.Web.Profile.ProfileModule" />
<add name="ErrorHandlerModule" type="System.Web.Mobile.ErrorHandlerModule, System.Web.Mobile, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</httpModules>

Basically, when the Http application starts, it will loop through all the http modules which are configured.

And SessionStateModule is one of them, and if you look into what SessionStateModule.Init() actually does. which in turn will call InitModuleFromConfig.



Notice that SessionStateSection config = RuntimeConfig.GetAppConfig().SessionState;

And here is what it does in RuntimeConfig.GetAppConfig().SessionState.

internal SessionStateSection SessionState
{
get
{
return (SessionStateSection) this.GetSection("system.web/sessionState", typeof(SessionStateSection));
}
}

Here is what it actually tried to read the section from "system.web/sessionState", but what if this section is missing, it will default all its values to default value of SessionStateSeciton. This is just my guessing, I tried to verify it through reflector, but the code is kind of confusing to me. When you cannot step through the code through debugger, you can only step through your code through your head. It becomes a little bit confusing..

Here is what I see the SessionStateSection in the reflector..