0

Just looking for some pointers really as I am totally new to UniData...

I am after pulling a table (if that is the right terminology??) from a UniData DB. The easiest way it seems is to do this using XML, which seems to be built in to the UniObjects API and UniData.

However, when using the API no XML is returned, just an empty XML error and when using UniCommand.command nothing at all is returned, just command status 0.

There seems to be some conflicting info here - some developers guides suggest the XML gets written to a file and not returned to the client?

Any pointers?

Cheers,

Kai.

UPDATE - Some code...

U2Connection con = new U2Connection();
U2ConnectionStringBuilder conn_str = new U2ConnectionStringBuilder();

try
{
    conn_str.UserID = "BLAH-BLAH";
    conn_str.Password = "BLAH-BLAH";
    conn_str.Server = "BLAH-BLAH";
    conn_str.AccessMode = "Native";   // FOR UO
    conn_str.RpcServiceType = "udcs"; // FOR UO
    conn_str.Database = "BLAH-BLAH";
    conn_str.ServerType = "UNIDATA";
    conn_str.Pooling = false;
    con.ConnectionString = conn_str.ToString();
}
catch (Exception ex)
{

}

con.Open();
UniSession us = con.UniSession;
UniCommand unicmd = us.CreateUniCommand();

unicmd.Command = "LIST ASSET_REPORT";
unicmd.Execute();

Console.Write(unicmd.CommandStatus + Environment.NewLine);
Console.Write(unicmd.Response);
Console.Write(Environment.NewLine + "Done...");
Console.ReadKey();

con.Close();

Just to confirm, with the above code I can execute commands and retrieve their output. However, if I change the command to something like "LIST ASSET_REPORT TOXML" (as per all the guides I have found) I get nothing back. Equally, if I use the UniXML functions:

UniXML xml = us1.CreateUniXML();

xml.GenerateXML("LIST DICT ASSET");

DataSet ds = xml.GetDataSet();

All I get are empty dataset exceptions?

4

1 回答 1

0

原则上,您的代码没有任何问题。我已经针对我的 UniData 服务器测试了您的代码(当然更改了文件名等),但没有收到任何错误。我还可以毫无问题地使用 TOXML 和 UniXML 方法 GenerateXML()。返回的 XML 数据完全符合我的预期。

请与我们分享以下信息:

  • 所有发生的错误消息的详细信息。
  • 您正在使用的 UniData 版本和 UniData 所基于的操作系统。
  • 调用 Execute() 方法后 unicmd.Response 的值是多少?您是否引用了一个空文件并只是获取根标签?

确实一定是您尚未与我们分享的东西导致了问题。

格伦

于 2013-01-09T14:00:24.373 回答