我正在开发一个应用程序,必须在数据库中的每台计算机上执行一些更新操作。每台机器都有一个唯一的ID。然后还有一个区号,几台机器都放在这下面。区号也是唯一的。我正在从数据库中读取这些ID并将其存储在列表中,然后我想使用这些ID逐一打入API。 API将给我一个响应,我必须相应地读取和更新数据库。我正在使用foreach,但我不知道自己在做什么错,因为它没有迭代列表的第二个元素(第二个id),而且我无法使用第二个ID调用该函数来访问API。
我能够正确阅读回复。主要问题是我无法使用列表中的第二个值调用api。
如果需要添加更多代码以进行澄清,请告诉我。
C#:
public static void ProcessIds(string areacode1, string areacode2)
{
// this is working fine I am getting correct values
List<IntermediateAPIRequest.IntermediateIds> Ids =
GetIntermediateIDList(areacode1, areacode2);
APIRequest api Request = new APIRequest();
前言 (IntermediateAPIRequest.IntermediateIds id in Ids)
{
//code for creating API request--this now fetches the 1st Id from
// the list and creates the request
APIresponse result = GetAPIResponsePerID(URL, id.machineID, api Request);
//Code for dealing with the response, for the time being I am
// simply displaying it onto the console.
} // end of 前言 loop
}
我能够正确阅读回复。主要问题是我无法使用列表中的第二个值调用api。
如果需要添加更多代码以进行澄清,请告诉我。