web服务检索图像从数据库使用linQ

本文关键字:linQ 数据库 服务 检索 图像 web | 更新日期: 2023-09-27 18:02:20

我正在编写这段代码,我想让一个web服务从数据库中检索图像..

和在ajax代码中使用这个web服务

有什么帮助吗?

感谢
    [WebMethod]
public List<BabyProfile> SelectPicOfBaby()
{
    BabyCareeEntities bc = new BabyCareeEntities();
    var query = (from s in bc.BabyProfiles
                 where  s.Image
                 select s).ToList<BabyProfile>();

    return query;

    //var quary1 = (from s in nw.Employees
    //             where s.EmployeeID == 1
    //             select s).ToList<Employee>();
}

web服务检索图像从数据库使用linQ

你想从BabyProfiles得到的东西中得到Image的属性吗?-(我想这是一个BabyProfile列表)

如果你真的想要,那么试试这个:

var query = (from s in bc.BabyProfiles
    select s.Image).ToList();

无论如何,你的问题相当不清楚,因为我不是100%确定你要求我们帮助你。