问题描述
我是 目前正在学习n层数据应用系统。我从Microsoft Developer Network遇到了一个演练(创建N层数据应用程序)。我想在服务中添加其他方法来插入,更新或删除数据,但我收到
错误。
I am currently learning n-tier data application systems. I came across a walkthrough (Creating an N-Tier Data Application) from Microsoft Developer Network. I wanted to add other methods in the service to insert, update or delete data but I get an error.
以下代码对我不起作用。
The following code does not work for me.
[OperationContract]
$
DataEntityTier.NORTHWNDDataSet.CustomersDataTable AddCustomer(string companyName,string contactName,string contactTitle,string address,string city,string region ,string postalCode,string country,string phone,string fax);
[OperationContract]
DataEntityTier.NORTHWNDDataSet.CustomersDataTable AddCustomer(string companyName, string contactName, string contactTitle,string address, string city, string region, string postalCode, string country, string phone,string fax);
在Service1.cs中,以下是方法:
And in the Service1.cs, the following was the method:
public DataEntityTier.NORTHWNDDataSet.SuppliersDataTable AddCustomer(string companyName,string contactName,string contactTitle,string address,string city,string region,string postalCode,string country,string phone,string fax)
public DataEntityTier.NORTHWNDDataSet.SuppliersDataTable AddCustomer(string companyName, string contactName, string contactTitle, string address, string city, string region, string postalCode, string country, string phone, string fax)
DataAccessTier。 NORTHWNDDataSetTableAdapters。 CustomersTableAdapter
CustomersTableAdapter1 = new DataAccessTier。 NORTHWNDDataSetTableAdapters。 CustomersTableAdapter();
返回CustomersTableAdapter1。 AddCustomer(companyName,contactName,contactTitle,address,city,region,postalCode,country,phone,fax);
}
DataAccessTier.NORTHWNDDataSetTableAdapters.CustomersTableAdapter
CustomersTableAdapter1 = new DataAccessTier.NORTHWNDDataSetTableAdapters.CustomersTableAdapter();
return CustomersTableAdapter1.AddCustomer(companyName, contactName, contactTitle, address, city, region, postalCode, country, phone, fax);
}
推荐答案
AddCustomer方法意味着在表适配器中生成了一个AddCustomer方法,该方法接受10个参数。你似乎已经生成了少于10的那个。
An AddCustomer method implies that there is generated in the table adapter a method AddCustomer, which takes in this case 10 arguments. It seems you have generated one with less than 10.
顺便说一下你可以看到顺便使用智能。
Normally you can see that using the intelisence by the way.
但是,它不是某个人不知道你生成的东西可以告诉你的东西,因为它不是框架代码。
However, it is not something somebody not knowing what you have generated can tell you because it is not framework code.
这篇关于为服务创建插入,更新和删除方法 - N层系统的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!