Pivot data not from SQL Server 2005


It is a happy journey to work the new functions in SQL Server 2005. I have played quite a lit with pivot functions in both static and dynamic ways. But the right place for doing this pivot should be in the application.
Jeff presented a good example in his blog:http://weblogs.sqlteam.com/jeffs/archive/2005/05/11/5101.aspx
with a customized PIVOT function: http://weblogs.sqlteam.com/jeffs/articles/5091.aspx
A simple test with GridView and SqlDataSource:
 
Page:

<asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString1 %>"

SelectCommand="SELECT [RecordNo], [SessionNo], [FluencyNo], [FluencyScore] FROM [pivotData3$]" DataSourceMode="DataReader">

</asp:SqlDataSource>

<asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="true"></asp:GridView>

Code:

protected

void Page_Load(object sender, EventArgs e)

{

GridView2.DataSource =

PivotFront.Pivot((SqlDataReader)SqlDataSource2.Select(DataSourceSelectArguments.Empty), "SessionNo", "FluencyNo", "FluencyScore");

GridView2.DataBind();

}

Advertisements


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s