Select to view content in your preferred language

Changing the SqlQuery of a layer

118
0
12-12-2024 11:08 AM
TommyBouchard
Emerging Contributor

C#

Hi, I am trying to change the SqlQuery in my layer and have it update to include my new fields.

var layer = map.Layers.First(layer => layer.Name == "name");
var conn = layer.GetDataConnection() as CIMSqlQueryDataConnection;

////Changing the query
conn.SqlQuery = "select * from " + conn.SqlQuery.Split(" from ").Last();
layer.SetDataConnection(conn, true);

My goal is to have all my new fields displayed in the table view.

The fields are not recalculated by SetDataConnection.

Is there a way to always view all my fields?

Thanks
Tommy

 

0 Kudos
0 Replies