Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1070405
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T20:33:46+00:00 2026-05-16T20:33:46+00:00

I’ve pieced together some information from other posts but I’m stuck. The first part

  • 0

I’ve pieced together some information from other posts but I’m stuck.

The first part works fine. Basically I query the database using LINQ and then I loop through the results generating a report.

Dim results As System.Linq.IQueryable(Of Bud900Reports.tblBud_CONNECT)

If options.Type = reportType.Organization Then
        results = From p In db.tblBud_CONNECTs _
                Where p.TableOldName = "tblFY" & options.FiscalYear And p.DEPTID = options.GroupFilter _
                Order By p.SOURCE_CODE, p.ROW_CODE_903 _
                Select p



    ElseIf options.Type = reportType.Division Then
        'Here is my problem line

End If

For each result in results
    'loop through code generating report
Next

Now instead of having three function with alot of dupelicate code, if the reportType is Division I want to run this query and put it into the results set.

results = (From p In db.tblBud_CONNECTs _
                  Where p.TableOldName = "tblFY" & options.FiscalYear And p.DIVISION_CODE = options.GroupFilter _
                  Group p By p.DIVISION_CODE, p.SOURCE_CODE, p.ROW_CODE_903 Into _
                  OrigEft = Sum(p.OrigEft), OrigAmt = Sum(p.OrigAmt), ABEft = Sum(p.ABEft), ABAmt = Sum(p.ABAmt) _
                  Order By DIVISION_CODE, SOURCE_CODE, ROW_CODE_903 _
                  Select DIVISION_CODE, SOURCE_CODE, ROW_CODE_903, OrigEft, OrigAmt, ABEft, ABAmt)

It’s the same data just grouped and summed up. But it comes through as an anonymous type. I tried to do “select new tblBud_CONNECTs with {.DIVISION_CODE = DIVISION_CODE, …}” but it gave me the error of “Explicit construction of entity type tblBud_CONNECTs is not allowed”.

How can I do what I want? It seems that I should be able to. Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T20:33:46+00:00Added an answer on May 16, 2026 at 8:33 pm

    For completeness I’ll answer my own question.

    First I created a class to hold the results.

    Private Class results
        Private mDivCode As String
        Public Property DivCode() As String
            Get
                Return mDivCode
    
            End Get
            Set(ByVal value As String)
                mDivCode = value
            End Set
        End Property
    
    
        Private mSourceCode As Short
        Public Property SourceCode() As Short
            Get
                Return mSourceCode
            End Get
            Set(ByVal value As Short)
                mSourceCode = value
            End Set
        End Property
    
    
        Private mRowCode As Short
        Public Property RowCode() As Short
            Get
                Return mRowCode
            End Get
            Set(ByVal value As Short)
                mRowCode = value
            End Set
        End Property
    
    
        Private mOrigEft As Decimal
        Public Property OrigEft() As Decimal
            Get
                Return mOrigEft
            End Get
            Set(ByVal value As Decimal)
                mOrigEft = value
            End Set
        End Property
    
    
        Private mOrigAmt As Decimal
        Public Property OrigAmt() As Decimal
            Get
                Return mOrigAmt
            End Get
            Set(ByVal value As Decimal)
                mOrigAmt = value
            End Set
        End Property
    
    
        Private mABEft As Decimal
        Public Property ABEft() As Decimal
            Get
                Return mABEft
            End Get
            Set(ByVal value As Decimal)
                mABEft = value
            End Set
        End Property
    
    
        Private mABAmt As Decimal
        Public Property ABAmt() As Decimal
            Get
                Return mABAmt
            End Get
            Set(ByVal value As Decimal)
                mABAmt = value
            End Set
        End Property
    
    End Class
    

    Then I set a variable to hold the results.

    Dim results As System.Linq.IQueryable(Of results)
    

    Then I made my linq query fill up the results like so.

    results = (From p In db.tblBud_CONNECTs _
                    Where p.TableOldName = "tblFY" & options.FiscalYear And p.DEPTID = options.GroupFilter _
                    Order By p.SOURCE_CODE, p.ROW_CODE_903 _
                    Select New results With {.DivCode = p.DIVISION_CODE, .SourceCode = p.SOURCE_CODE.Value, .RowCode = p.ROW_CODE_903.Value, _
                                             .OrigEft = p.OrigEft.Value, .OrigAmt = p.OrigAmt.Value, .ABEft = p.ABEft.Value, .ABAmt = p.ABAmt.Value})
    

    That’s how I ended up doing what I wanted.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For some reason, after submitting a string like this Jack’s Spindle from a text
I have a bunch of posts stored in text files formatted in yaml/textile (from
I have a view passing on information from a database: def serve_article(request, id): served_article
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
Basically, what I'm trying to create is a page of div tags, each has
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.