asp.net 使用Silverlight操作ASPNETDB数据库
程序员文章站
2024-03-08 23:10:22
1.在server端添加silverlight-enabled wcf service 复制代码 代码如下:[servicecontract(namespace = "")...
1.在server端添加silverlight-enabled wcf service
[servicecontract(namespace = "")]
[aspnetcompatibilityrequirements(requirementsmode = aspnetcompatibilityrequirementsmode.allowed)]
public class service1
{
[operationcontract]
public void dowork(string name,string pwd,string email,string question,string answer)
{
membershipcreatestatus status;
membership.createuser(name, pwd,email,question,answer,true,out status);
}
// add more operations here and mark them with [operationcontract]
}
2. 添加此service 引用到silverlight
servicereference2.service1client client = new servicereference2.service1client();
client.doworkasync("xxifusi", "xxifusi345","d22@we.com","q","a");
复制代码 代码如下:
[servicecontract(namespace = "")]
[aspnetcompatibilityrequirements(requirementsmode = aspnetcompatibilityrequirementsmode.allowed)]
public class service1
{
[operationcontract]
public void dowork(string name,string pwd,string email,string question,string answer)
{
membershipcreatestatus status;
membership.createuser(name, pwd,email,question,answer,true,out status);
}
// add more operations here and mark them with [operationcontract]
}
2. 添加此service 引用到silverlight
复制代码 代码如下:
servicereference2.service1client client = new servicereference2.service1client();
client.doworkasync("xxifusi", "xxifusi345","d22@we.com","q","a");
上一篇: Mybatis与Hibernate的区别
推荐阅读