注册 登录
编程论坛 ASP技术论坛

关于TableAdapter调用insert,update,delete问题

kingln 发布于 2007-09-20 01:31, 690 次点击

我在建立TableAdapter时在“高级”里选择了“生成插入,更新,和删除语句” 这个选项。然后我的TableAdapter的"属性"里就出现了InsertCommand,UpdateCommand, 和DeleteCommand这几个属性 不是说当你在程序中调用insert,update,delete的时候就会直接调用到以上几个command属性么?但是我发现在应用TableAdapter调用insert,update,delete时候根本不行,错误提示是说这几个东西并不在TableAdapter里面 我不知道为什么有属性却不能调用 能给我解释一下么?

下面是我的代码
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using NorthwindTableAdapters;

public partial class Default2 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)

{
NorthwindTableAdapters.ProductsTableAdapter productsAdapter =new NorthwindTableAdapters.ProductsTableAdapter();

///////中间代码略/////



productsAdapter.Update(products);//就在这里!说UpDate不是productsAdapte的属性


}
}

1 回复
#2
yms1232007-09-20 11:36
NorthwindTableAdapters;
这个组件明显不是.NET自身的组件,楼主下载的还是自定义的?
1