当我尝试使用ExecuteQueryReq查询时,CUCM axl api返回system.object

问题描述 投票:0回答:1

当我尝试使用下面的代码从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 = [email protected]<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'。

有没有一种方法可以不经过来回转换就返回数据?>

我一直在关注示例here

任何帮助将不胜感激

[当我尝试从CUCM AXL api返回数据时,使用下面的代码ExecuteSQLQueryReq query = new ExecuteSQLQueryReq(); query.sql =“从systables中选择*”;字符串[]模型= ...

c# xml cisco cisco-axl
1个回答
0
投票

诀窍应该是将return / rows转换为'ElementNSImpl',例如如参考样本中https://github.com/CiscoDevNet/axl-dotnet-samples所示:

© www.soinside.com 2019 - 2024. All rights reserved.