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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T04:36:50+00:00 2026-06-10T04:36:50+00:00

I have selected multiple columns from my table, but I don’t know how to

  • 0

I have selected multiple columns from my table, but I don’t know how to pass it to my view.

 var result = (from f in db.firmware
               where f.firmware_release_type_text != "" 
                     || f.firmware_release_type_text != null 
                     || f.firmware_release_number_int != 0
               select new{
                    f.firmware_release_type_text, 
                    f.firmware_release_number_int
               }).Distinct();

The result is f__anonymous2. I want to some how use it in my view. all the forums have just answered how to choose multiple columns, but nobody mentions how to pass them. I think I’m missing something obvious.

I want to be able to use this fields, or even merge them as one string.

I have tried Cast and so many other options which did not work.

When I try to force casting it sting, I get :

Unable to cast the type 'Anonymous type' to type 'System.String'

Thanks

UPDATE:

At the end I went with:

var result = (from f in db.firmware
              where (f.firmware_release_type_text != "") 
                    && (f.firmware_release_type_text != null) 
                    && (f.firmware_release_number_int != 0)
              select  new{
                          f.firmware_release_type_text, 
                          f.firmware_release_number_int
                      }
              ).Distinct();

        List<string> result2 = new List<string>();
        foreach (var item in result)
        {
            result2.Add(item.firmware_release_type_text 
                        + "-" + item.firmware_release_number_int);
        }
  • 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-06-10T04:36:51+00:00Added an answer on June 10, 2026 at 4:36 am

    If you want to return your data as a string you have to say how it should be formatted. You could for example change this:

    select new
    {
        f.firmware_release_type_text , f.firmware_release_number_int
    }
    

    To this:

    select f.firmware_release_type_text + " v" + (int)f.firmware_release_number_int
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have multiple columns in a table but I only want the highest value
I have a situation where I want to associate multiple values from one table
I have a table of orders with multiple date columns (Department finished dates). I'd
We have a customer very large table with over 500 columns (i know someone
In My .rpt file I have selected "format with multiple columns" option and Edited
I have created checkboxes. When I selected multiple checkboxes then how can I get
I have selected two components in the Customize Layout screen using a hint from
I have an excel sheet, in which i have multiple cells selected, which are
I have a listview with multiple columns. One of the columns is a checkbox,
I have a ListBox that can have multiple items selected at once. I have

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.