Quantcast
Channel: Web Forms
Viewing all articles
Browse latest Browse all 23244

How show data from database in the label

$
0
0

I have one table Car(CarID(int) , NameCar(varchar(50), Mileage(varchar(50), Manufacture(varchar(50), Price(varchar(50)).

I want to show price of Car in the label tab when select the car from dropdownlist.

I use this code:

In DBBL.cs Class:

        public List<Car> GetAllCars()
        {
            return context.Car.ToList();
        }


          public Car rate(int id)
        {
            return context.Car.Where(x=>x.CarID==id).Select(x=>x.Price).SingleOrDefault();
        }
//Prints the error: "Cannot implicitly convert type 'string' to 'CarRent.Data.EF.DAL.Cars "

What should be done to resolve this?

Thanks in advance


Viewing all articles
Browse latest Browse all 23244

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>