1
业务对象,我做了以下内容:ObjectDataSource控件无法看到的app_code
- 创建一个简单的网站
- 添加在App_Data文件夹
- NORTHWIND数据库连接创建的app_code业务对象文件夹
- bal.cs商业对象在app_code中的biz文件夹中的类
- 在app_code中创建数据文件夹linq to sql drag Ë客户表中有
- 创建一个新的page.aspx
- 阻力在下拉列表
- 配置数据源
- 一个ObjectDataSource添加到页面中BAL我的ObjectDataSource控件
无可以看到.cs可以看到这个类。 做什么??????????? !!!!
using System;
using System.Collections.Generic;
using System.Linq;
using Data;
public class BAL
{
public List<String> GetCountries()
{
using (var context = new NORTHWINDDataContext())
{
return (from c in context.customers
select c.country).Tolist();
}
}
public List<customer> GetCustomersByCountry(string country)
{
using (var context = new NORTHWINDDataContext())
{
return (from c in context.customers
where c.country == country
select c).Tolist();
}
}
public customer GetCustomer(string custID)
{
using (var context = new NORTHWINDDataContext())
{
return (from c in context.customers
where c.CustomerID == custID
select c).singleOrDefalt();
}
}
}
感谢您的回放,我在.aspx页面中完成了此操作,并且class bal出现了,但在bal类中,当我将其属性更改为编译它会生成一个错误错误无法找到类型或名称空间名称'Customer'(您是否缺少使用指令或程序集引用?) – 2011-12-14 19:47:05