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

  • SEARCH
  • Home
  • 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 1014651
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T10:16:54+00:00 2026-05-16T10:16:54+00:00

I am building an asp.net site in .net framework 4.0, and I am stuck

  • 0

I am building an asp.net site in .net framework 4.0, and I am stuck at the method that supposed to call a .cs class and get the query result back here is my method call and method

1: method call form aspx.cs page:

helper cls = new helper();
  var query = cls.GetQuery(GroupID,emailCap); 

2: Method in helper class:

public IQueryable<VariablesForIQueryble> GetQuery(int incomingGroupID, int incomingEmailCap)
    {
        var ctx = new some connection_Connection();
        ObjectSet<Members1> members = ctx.Members11;
        ObjectSet<groupMember> groupMembers = ctx.groupMembers;

        var query = from m in members
                    join gm in groupMembers on m.MemberID equals gm.MemID
                    where (gm.groupID == incomingGroupID) && (m.EmailCap == incomingEmailCap)
                    select new VariablesForIQueryble(m.MemberID, m.MemberFirst, m.MemberLast, m.MemberEmail, m.ValidEmail, m.EmailCap);
                    //select new {m.MemberID, m.MemberFirst, m.MemberLast, m.MemberEmail, m.ValidEmail, m.EmailCap};

        return query ;
    }

I tried the above code with IEnumerable too without any luck. This is the code for class VariablesForIQueryble:

3:Class it self for taking anonymouse type and cast it to proper types:

public class VariablesForIQueryble
{
    private int _emailCap;
    public int EmailCap
    {
        get { return _emailCap; }
        set { _emailCap = value; }
    }`....................................

4: and a constructor:

 public VariablesForIQueryble(int memberID, string memberFirst, string memberLast, string memberEmail, int? validEmail, int? emailCap)
    {

            this.EmailCap = (int) emailCap;
            .........................

    }

I can’t seem to get the query result back, first it told me anonymous type problem, I made a class after reading this: link text; and now it tells me constructors with parameters not supported. Now I am an intermediate developer, is there an easy solution to this or do I have to take my query back to the .aspx.cs page.

  • 1 1 Answer
  • 1 View
  • 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-16T10:16:55+00:00Added an answer on May 16, 2026 at 10:16 am

    Used reflection to solve the problem:

    A: Query, not using custom made “VariablesForIQueryble” class any more:

     //Method in helper class 
     public IEnumerable GetQuery(int incomingGroupID, int incomingEmailCap)
            {
    
                var ctx = new some_Connection();
                ObjectSet<Members1> members = ctx.Members11;
                ObjectSet<groupMember> groupMembers = ctx.groupMembers;
    
                var query = from m in members
                            join gm in groupMembers on m.MemberID equals gm.MemID
                            where ((gm.groupID == incomingGroupID) && (m.EmailCap == incomingEmailCap)) //select m;
                            select new {  m.MemberID,  m.MemberFirst,  m.MemberLast, m.MemberEmail,  m.ValidEmail, m.EmailCap };
                            //select new VariablesForIQueryble (m.MemberID, m.MemberFirst, m.MemberLast, m.MemberEmail, m.ValidEmail, m.EmailCap);
                //List<object> lst = new List<object>();
    
                //foreach (var i in query)
                //{
                //    lst.Add(i.MemberEmail);
                //}
                //return lst;
                //return query.Select(x => new{x.MemberEmail,x.MemberID,x.ValidEmail,x.MemberFirst,x.MemberLast}).ToList();
                return query;
            }
    

    B:Code to catch objects and conversion of those objects using reflection

      helper cls = new helper();
      var query = cls.GetQuery(GroupID,emailCap);      
     if (query != null)
                        {
    
                            foreach (var objRow in query)
                            {
    
                                System.Type type = objRow.GetType();
                                int memberId = (int)type.GetProperty("MemberID").GetValue(objRow, null);
                                string memberEmail = (string)type.GetProperty("MemberEmail").GetValue(objRow, null);
        }
        else
        {
        something else....
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

im building a asp.net web site with 2.0 framework. I've been fighting with web.config,
I'm building an ASP.NET MVC site that uses LINQ to SQL. In my search
I'm building an ASP.NET MVC site that uses LINQ to SQL to connect to
I'm building an ASP.NET MVC site using the ADO.NET Entity Framework. I have an
I'm building an ASP.NET MVC 3 site using the code-first Entity Framework 4 approach.
I am building an ASP.NET web site that uses FormsAuthentication and a standard Session
I'm building an ASP.NET MVC 3 site that allows users to register. To that
I'm building a web site (asp.net) for a company that manufactures small customizable anodized
I am building ASP MVC web site using Entity Framework 4.4 with .NET Framework
I am building a site in ASP.NET 4 and MVC2 that will have premium

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.