【发布时间】:2014-08-06 14:49:26
【问题描述】:
我有一个有一些属性的类
public class SendData
{
public int MerchantID{get; set;}
public string Name{get; set;}
public int Age{get; set;}
}
然后单击按钮并将用户数据初始化为此类的对象。
button_click()
{
SendData senddata = new SendData();
senddata.MerchantID = Convert.ToInt32(txtMerchantid.Text);
senddata.Age = Convert.ToInt32(txtAge.Text);
senddata.Name= txtName.Text;
Webservice1.ReceiveDataService serviceObj = new Webservice1.ReceiveDataService();
public bool result = serviceObj.UpdateData(senddata); // calling web service
if(result) //Here is the scenario
lblresult.Text="Updated";
else
lblresult.Text="Operation unsuccessful";
}
现在我如何在 webservice 方法上读取该对象的所有字段?
我的网络方法:
public bool updatedata()//How to pass that object here
{
//How can i get those three values in three separate fields in this method like.
string name =""; //that name from UI;
int id = ;//Id from UI
int age= ;//Age from UI
//All the field need to be stored in database those coding will come here.
return true;
}
它很简单,但请帮助我,你也可以建议我一些最好的和替代的方法来实现。 谢谢,
【问题讨论】:
标签: c# asp.net web-services class