I just upgraded K2 from 4.5 to 4.6. After upgrading, I have some code that used to work in 4.5, but now no longer works in 4.6. The code involves connecting to a SmarObjectClientServer, as is provided below:
SMOServer = new SmartObjectClientServer();
string connStr = string.Format("Integrated=True;IsPrimaryLogin=True;Authenticate=True;EncryptedPassword=False;Host=localhost;Port=5555");
SMOServer.CreateConnection();
SMOServer.Connection.Open(connStr);
When I set a breakpoint at the last line -- SMOServer.Connection.Open(connStr) -- the connection port has a value of 0, even though I'm setting it to 5555 in the connection string. And when I try to run a query a SmartObject using the following code:
command = new SOCommand();
command.Connection = new SOConnection(this.SMOServer.Connection.Host, int.Parse(this.SMOServer.Connection.Port.ToString()));
command.Connection.DirectExecution = directExecution;
command.CommandText = sql;
if (parameters.Count > 0)
{
command.CommandType = CommandType.StoredProcedure;
foreach (KeyValuePair<string, object> item in parameters)
{
command.Parameters.Add(new SOParameter(item.Key, item.Value.ToString()));
}
}
SODataAdapter adapter = new SODataAdapter(command);
dataTable = new DataTable();
adapter.Fill(dataTable);
I get the following error message:
Open Failed : Host and/or Port invalid.
Is there anything I need to add or remove in the connection string? This worked without any issues in 4.5
Thanks,
Craig