【发布时间】:2012-05-22 09:07:39
【问题描述】:
下面的代码是 web 方法(这是最常见的一种,你可以在任何地方看到它),但我一直从标题中得到错误。我是 .NET 的起步者,所以如果有人能指出我正确的方向,请这样做。
SqlConnection myConnection = new SqlConnection(ConfigurationManager.ConnectionStrings["mySQLconn"].ConnectionString);
[WebMethod(Description = "Select Customers")]
public string GetVersionofSelectedCustomer(string versionEmail)
{
string select = "SELECT version FROM customer WHERE EMAIL = '" + versionEmail + "'";
SqlDataAdapter adapter = new SqlDataAdapter(select, myConnection);
DataSet custDS = new DataSet();
//adapter.MissingSchemaAction = MissingSchemaAction.AddWithKey;
adapter.Fill(custDS, "Customers");
return custDS;
}
connection 在 Web.config(本地连接)中定义,return custDS; 是它失败的地方。
【问题讨论】:
-
你为什么要返回一个DataSet,也许你可以返回一个包含客户列表的JSON响应。
标签: asp.net web-services soap