Asp.net 如何将数据表从fiddler传递到webservice?
我在web服务中有两个函数,一个用于获取所有记录,另一个用于更新记录。为了实现这一点,我在web服务中使用了数据集(datatable)Asp.net 如何将数据表从fiddler传递到webservice?,asp.net,web-services,fiddler,Asp.net,Web Services,Fiddler,我在web服务中有两个函数,一个用于获取所有记录,另一个用于更新记录。为了实现这一点,我在web服务中使用了数据集(datatable) [WebMethod( Description = "Returns Northwind Customers", EnableSession = false )] public DataSet GetCustomers() { SqlDataAdapter custDA = new SqlDataAdapter("SELECT Customer
[WebMethod( Description = "Returns Northwind Customers", EnableSession = false )]
public DataSet GetCustomers()
{
SqlDataAdapter custDA = new SqlDataAdapter("SELECT CustomerID, CompanyName FROM Customers", nwindConn);
DataSet custDS = new DataSet();
custDA.MissingSchemaAction = MissingSchemaAction.AddWithKey;
custDA.Fill(custDS, "Customers");
return custDS;
}
[WebMethod( Description = "Updates Northwind Customers", EnableSession = false )]
public DataSet UpdateCustomers(DataSet custDS)
{
SqlDataAdapter custDA = new SqlDataAdapter();
custDA.InsertCommand = new SqlCommand("INSERT INTO Customers (CustomerID, CompanyName) " +
"Values(@CustomerID, @CompanyName)", nwindConn);
custDA.InsertCommand.Parameters.Add("@CustomerID", SqlDbType.NChar, 5, "CustomerID");
custDA.InsertCommand.Parameters.Add("@CompanyName", SqlDbType.NChar, 15, "CompanyName");
custDA.UpdateCommand = new SqlCommand("UPDATE Customers Set CustomerID = @CustomerID, " +
"CompanyName = @CompanyName WHERE CustomerID = @OldCustomerID", nwindConn);
custDA.UpdateCommand.Parameters.Add("@CustomerID", SqlDbType.NChar, 5, "CustomerID");
custDA.UpdateCommand.Parameters.Add("@CompanyName", SqlDbType.NChar, 15, "CompanyName");
SqlParameter myParm = custDA.UpdateCommand.Parameters.Add("@OldCustomerID", SqlDbType.NChar, 5, "CustomerID");
myParm.SourceVersion = DataRowVersion.Original;
custDA.DeleteCommand = new SqlCommand("DELETE FROM Customers WHERE CustomerID = @CustomerID", nwindConn);
myParm = custDA.DeleteCommand.Parameters.Add("@CustomerID", SqlDbType.NChar, 5, "CustomerID");
myParm.SourceVersion = DataRowVersion.Original;
custDA.Update(custDS, "Customers");
return custDS;
}
我想从任何其他客户端(而不是网络框架)调用此web服务,如fiddler、android或php
您能告诉我如何从fiddler调用这个web服务来测试它吗。它是否工作正常
向我推荐任何可用的链接或示例代码。只需将fiddle附加到浏览器的进程id,并确保在“文件”菜单下选中“捕获流量”
BTW.,如果考虑使用Ajax检索和更新GRIDVIEW,则:
List
,其中MyClass定义表的数据结构,并将响应格式设置为JSON[ScriptMethod(ResponseFormat=ResponseFormat.JSON)]
。然后,您需要用JavaScript构建html表