Closed GoogleCodeExporter closed 9 years ago
implemented in 0.9.2. See IApiConnector.ApiExecuteScalar method.
Original comment by daniel.f...@gmail.com
on 23 Jul 2011 at 3:35
Hello Daniel, I would like to know how to get a single value.
example:
Session = new TikSession TikSession (TikConnectorType.Api);
session.Open ("192.168.1.2", "admin", "");
IApiConnector apiConnector = (IApiConnector) session.Connector; //!!! MOST important row in sample
/ / execute scalar - select for single value
apiConnector.ApiExecuteScalar string result = ("/ system / identity / print", new Dictionary <string, string> {{"name", ""}});
Response.Write (result);
This example is used to take the number of people connected, but I'd like to
take a single value, just the name of RB, as I do that?
Instead of count-only, tried to put name, but the wrong!
I await answers.
Original comment by helber...@gmail.com
on 18 Jan 2012 at 2:23
Hi,
u should use ExecuteReader pattern when requesting "entity".
//execute reader without filter
//note: exactly one row is always returned in this case
var result = apiConnector.ApiExecuteReader("/system/identity/print");
Console.WriteLine(result[0].GetStringValueOrNull("name", true));
Original comment by daniel.f...@gmail.com
on 18 Jan 2012 at 6:27
Original issue reported on code.google.com by
daniel.f...@gmail.com
on 26 Jun 2011 at 3:34