Memos of my LinqDatasource experience

How to group by more than 1 table column (attribute, property)?

GroupBy="new(Roles.RoleName, Roles.RoleId)" Access with: Key.RoleName, (for example in your listview or gridview)

<asp:LinqDataSource runat="server" ID="ldsUsers"
ContextTypeName="MyPrivateProject.Test.DataAccess.MyPersonalPrivateDataContext" TableName="Users" GroupBy="new(Roles.RoleName, Roles.RoleId)" OrderGroupsBy="Key.RoleName" OrderBy="UserName, Lastname, Firstname" Select="new(Key, Count() As RecordCount, It As Users)" > </asp:LinqDataSource>

How to use Guids in LinqDataSource where Parameters?

Use DbType="Guid" instead of Type="xxx". TODO: Check input param! e.g. MyPage.aspx?UserIdInput=xxxasd-grrrr-blabla-TEXT-FFAILS --> throws an error

<asp:LinqDataSource runat="server" ID="ldsUsers"
   ContextTypeName="MyPrivateProject.Test.DataAccess.MyPersonalPrivateDataContext"
   TableName="Users"
   Where="UserId = @UserIdInput" EnableUpdate="True">
     <WhereParameters>
          <asp:QueryStringParameter
                 DefaultValue="none" Name="UserIdInput"
                 QueryStringField="UserId" 
              DbType="Guid"  />
     </WhereParameters>
</asp:LinqDataSource>

Syntax highligthing provided by FaziBear's Google widget But removed cause it doesnt support Highlighting of single lines nor sections

1 comment:

Unknown said...

If you need syntax highlighting, this may match your needs.

Post a Comment

Latest Posts

Popular Posts