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 585587
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T15:01:06+00:00 2026-05-13T15:01:06+00:00

I have IQueryable object and I need to take the data inside the IQueryable

  • 0

I have IQueryable object and I need to take the data inside the IQueryable to put it into Textboxs controls. Is this possible?

I try something like:

public void setdata (IQueryable mydata)
{

    textbox1.text = mydata.????

}

Update:

I’m doing this:

public IQueryable getData(String tableName, Hashtable myparams)
{
        decimal id = 0;

        if (myparams.ContainsKey("id") == true)
             id = (decimal)myparams["id"];

        Type myType= Type.GetType("ORM_Linq." + tableName + ", ORM_Linq");

        return this.GetTable(tableName , "select * from Articu where id_tipo_p = '" + id + "'");

}


public IQueryable<T> GetTable<T>(System.Linq.Expressions.Expression<Func<T, bool>> predicate) where T : class
{
    return _datacontext.GetTable<T>().Where(predicate);
}

This returns a {System.Data.Linq.SqlClient.SqlProvider+OneTimeEnumerable1[ORM_Linq.Articu]}`

I don’t see any method like you tell me. I see Cast<>, Expression, ToString…

  • 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-13T15:01:07+00:00Added an answer on May 13, 2026 at 3:01 pm

    EDIT: Updated based on additional info from your other posts…

    Your getData method is returning IQueryable instead of a strongly typed result, which is why you end up casting it. Try changing it to:

    public IQueryable<ORM_Linq.Articu> getData(...)
    

    Are you trying to query for “Articu” from different tables?

    With the above change in place, your code can be rewritten as follows:

    ORM_Linq.Articu result = mydata.SingleOrDefault();
    if (result != null)
    {
        TextBoxCode.Text = result.id.ToString();
        TextBoxName.Text = result.descrip; 
    }
    

    If you have a single result use SingleOrDefault which will return a default value if no results are returned:

    var result = mydata.SingleOrDefault();
    if (result != null)
    {
           textbox1.text = result.ProductName; // use the column name
    }
    else
    {
        // do something
    }
    

    If you have multiple results then loop over them:

    foreach (var item in mydata)
    {
       string name = item.ProductName;
       int id = item.ProductId;
       // etc..
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have this in my BlogRepository public IQueryable<Subnus.MVC.Data.Model.Post> GetPosts() { var query = from
I have an IQueryable and an object of type T. I want to do
I have an List and I'd like to wrap it into an IQueryable. Is
I have a table that I need to extract data from, and wish to
I have this slice of code IQueryable<Dealer> dealers = from dealer in Dealers join
Currently my repository returns an IQueryable object that lists the data from my DB
I have the following linq query which returns a Report Object; yet I need
I have IQueryable list of objects of type T which I want to transform
I have a method that takes an IQueryable. Is there a LINQ query that
Have been looking at the MVC storefront and see that IQueryable is returned from

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.