private string DetermineRemoteGeomType(FeatureLayer layer) { MapInfo.Data.Table t = layer.Table; MapInfo.Styles.Style style = null; MIConnection con = null; MICommand cmd = null; MIDataReader dr = null; try { con = new MIConnection(); con.Open(); cmd = con.CreateCommand(); cmd.CommandText = "select mi_style from \"" + t.Alias + "\""; cmd.CommandType = System.Data.CommandType.Text; dr = cmd.ExecuteReader(); while (dr.Read()) { if (!dr.IsDBNull(0)) { style = dr.GetStyle(0); break; } } } catch (MIException) { // e.g. if there is no mi_style column } finally { if (cmd != null) { cmd.Dispose(); cmd = null; } if (dr != null) { dr.Close(); } if (con != null) { con.Close(); con = null; } } if (style != null) { if (style is SimpleLineStyle) { return("lclayerline.bmp"); } else if (style is SimpleInterior || style is AreaStyle) { return("lclayerregion.bmp"); } else if (style is BasePointStyle) { return("lclayerpoint.bmp"); } else { return("lclayer.bmp"); } } else { return(null); } }