C#之旅

           走自己的路,让别人打的去吧。
随笔 - 66, 文章 - 0, 评论 - 117, 引用 - 2
数据加载中……

vs2005中的强类型dataset

vs2005中的新的dataset,与2003中有着不同,创建 Typed dataset后,系统自动加入了TableAdpter,根据提供的这个TableAdapter,就可以很方便的写出DataAccess Layer Code,DataAccess Layer的编写更加简便,以下是一个简单的示例。

using System;
using System.Collections.Generic;
using System.Text;

namespace DatasetTest
{
    
public class TestDataAccess:IDisposable 
    
{
        
private dsNorthwindTableAdapters.CustomersTableAdapter dsc = new DatasetTest.dsNorthwindTableAdapters.CustomersTableAdapter();
        
public dsNorthwind.CustomersRow RetiereCustomersRow(string customersid)
        
{
            
//dsNorthwindTableAdapters.CustomersTableAdapter ct = new DatasetTest.dsNorthwindTableAdapters.CustomersTableAdapter();
            dsNorthwind.CustomersRow dcr = dsc.GetDataByCustomerID(customersid)[0];
            
return dcr;
 
        }

        
public dsNorthwind.CustomersDataTable RetiereCustmoers()
        
{
            
//dsNorthwindTableAdapters.CustomersTableAdapter ct = new DatasetTest.dsNorthwindTableAdapters.CustomersTableAdapter();
            return dsc.GetData();
          
        }

        
public void UpdateCustomers(dsNorthwind.CustomersRow CustomersRow)
        
{
            dsc.Update(CustomersRow);
            
        }


        
IDisposable 成员
    }

}

posted on 2006-04-15 14:26 c#之旅 阅读(1025) 评论(2)  编辑 收藏 网摘 所属分类: Typed DataSet

评论

#1楼    回复  引用    

请问一下,你上面做的那个DEMO可以提供下载一下吗?
或者将它发到我邮箱?
在网上找这个东西找了很久哦.
denli8@163.com
谢谢了!
2007-05-09 11:38 | denli [未注册用户]

#2楼    回复  引用    

自定义可绑定数据的业务对象实体和强类型
http://user.qzone.qq.com/184912535/blog/1198893009
2007-12-31 11:35 | mickeysuda [未注册用户]




标题  
姓名  
主页
Email (博主才能看到) 
验证码 *  看不清,换一张 [登录][注册]
内容(请不要发表任何与政治相关的内容)  
  登录  使用高级评论  新用户注册  返回页首  恢复上次提交      
该文被作者在 2006-04-19 11:46 编辑过
Google站内搜索

China-pub 计算机图书网上专卖店!6.5万品种 2-8折!
近千种 9-95 新二手计算图书火热销售中!
开发者征途系统新作:《设计模式——基于C#的工程化实现及扩展》

相关文章:

相关链接: