C# 在客户端应用程序中获取对richTextBox的用户XML响应
我正在调用一个web服务函数,该函数正在从数据库中读取用户凭据 当直接从web服务中基于输入“搜索”整数调用时,响应为-C# 在客户端应用程序中获取对richTextBox的用户XML响应,c#,sql,web-services,client,C#,Sql,Web Services,Client,我正在调用一个web服务函数,该函数正在从数据库中读取用户凭据 当直接从web服务中基于输入“搜索”整数调用时,响应为- <firstName>john</firstName> <lastName>smith</lastName> <sex>male</sex> <age>23</age> <search>100</search> 但是,这不起作用。根据您的评论 string
<firstName>john</firstName>
<lastName>smith</lastName>
<sex>male</sex>
<age>23</age>
<search>100</search>
但是,这不起作用。根据您的评论
string result = client.searchUser(search);
您正在尝试将at结构指定给字符串。这就是错误所在,编译器告诉您不能这样做
您应该在结构中重写ToString()
方法,如
public override string ToString()
{
// construct the string here which you want to assign
}
在你的客户方面
string result = client.searchUser(search).ToString();
希望它能有所帮助。错误是什么?在哪一行?无法将类型“WebService.downloadUser”隐式转换为“string”,后者是WebService中创建数组的结构体[]
string result = client.searchUser(search).ToString();