下面是数据文本文件的格式
“t:”是加入 【程序编程相关:中国共享软件走向国际指南 】
“#”号是注释 【推荐阅读:用VB.NET和Excel排生产计划 】
“c:”是检查数据 【扩展信息:从注册表读取程序的版本 】
“d:”是删除表里面的数据
数据与数据之间用tab隔开(可以从企业管理器直接把数据拷贝出来作为数据源)
加入数据的事列如下:
#插入用户表# null为插入空t:usersjohn <tab>john chancake<tab>cake.lujeff<tab>jeff.hu
# checktables data#null为检查是否为空,skip掉过不检查,notnull检查他是否不为空c:usersjohn <tab>john chancake<tab>cake.lujeff<tab>jeff.hu
#delete all datad:tablename
调用代码:参数1:文本文件的路径参数2:是helper里面的两个常量(其实可以是个enum,不过写的时候没有注意)helper.executeaction("data.txt",helper.insert);
参数3:是指定对那个对象操作(t:d:c:后面的名称,如t:users,那么就填users)helper.executeaction("data.txt",helper.insert,"users")
代码如下:
using system;using system.data;using system.io;using system.data.sqlclient;using microsoft.applicationblocks.data;using nunit.framework;
... 下一页