当我尝试从 CUCM AXL api 返回数据时,使用下面的代码
ExecuteSQLQueryReq query = new ExecuteSQLQueryReq();
query.sql = "select * from systables ";
string[] model = null;
//get tables
try
{
executeSQLQueryResponse response = await client.executeSQLQueryAsync(query);
model = response.executeSQLQueryResponse1.@return.Cast<string>().ToArray();
}
catch (Exception ex)
{
Console.WriteLine($"\nError: getQuery: { ex.Message }");
Environment.Exit(-1);
}
Console.WriteLine($"\ngetQuery: SUCCESS model: { model }\n ");
我得到 sytem.object[] 而不是 sql 数据,我尝试使用下面的代码从每个数据循环
foreach ( string no in model)
{
Console.WriteLine(no.ToString());
}
我得到的错误是:
无法将“System.Xml.XmlNode[]”类型的对象转换为“System.String”类型。
有没有办法在不来回转换的情况下获取返回的数据
我一直在关注这里的例子
任何帮助,将不胜感激