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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T06:15:01+00:00 2026-06-18T06:15:01+00:00

I have, var car = db.QuerySingle(SELECT * FROM Stock WHERE Id = @0, carId);

  • 0

I have,

var car = db.QuerySingle("SELECT * FROM Stock WHERE Id = @0", carId);

The table “Stock” has image data columns ImgF1, ImgF2, …, ImgF12.
Now I want to retrieve those images as shown below

<ul>
@for(int i = 1; i < 12; i++){
    var imageName = "ImgF" + i;
    if(car.@imageName != null){
        <li>
            <img class="small_image" alt="image" src="@Href("~/Cars/XSThumbnail",carId, new{index = i})">
        </li>
    }else{

    }
}

The problem is that car.@imageName or car.imageName don’t work as imageName is not the column name but just a variable for column names.


So please, if you have any ideas i’ll be grateful !!

  • 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-18T06:15:03+00:00Added an answer on June 18, 2026 at 6:15 am

    Under the hood the QuerySingle method returns a DynamicRecord instance what you can index with the column name:

    @for(int i = 1; i < 12; i++){
        var imageName = "ImgF" + i;
        if(car[imageName] != null){
            <li>
                <img class="small_image" alt="image" 
                     src="@Href("~/Cars/XSThumbnail",carId, new{index = i})">
            </li>
        }else{
    
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hi All I have a string like this var data='mobile,car,soap,room'; I am parsing from
I have 2 large XML files: Car data (id, name, image, etc). Deals (car_id,
I have the following code: var carsContext = new CarsDataContext(); IQueryable<Car> allCars = carsContext.Cars;
So I have an object of ArrayProxy kind var App = Ember.Application.create(); App.car =
I have a query: var contactInfos = from person in persons join tempDesiredCar in
I have blocks of code that look like: ICar car = new Car<int>(10); var
I have this Car function: var Car = function(vendor, model, year) { return {
I have this Jquery code and i need to add the var data and
I want to place fields from a model in a select list. I have
I have this array var car = new Array(); car['brand'] = Ford; car['color'] =

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.