private static List <NaturalEarthRow> GetNaturalEarthTableRows(string tableName, string connectionString)
        {
            List <NaturalEarthRow> rows = new List <NaturalEarthRow>();

            using (SqlConnection con = new SqlConnection(connectionString))
            {
                con.Open();
                using (SqlCommand com = new SqlCommand(string.Format("SELECT * FROM [{0}]", tableName), con))
                {
                    using (SqlDataReader dr = com.ExecuteReader())
                    {
                        List <ColInfo> colInfos = GetColumnsInfo(dr);
                        ColInfo        nameCol  = FindColumnByNameOrType(colInfos, "name", "String");             // find first column named "name" or else first string column
                        ColInfo        geomCol  = FindColumnByNameOrType(colInfos, "geom", null);                 // find first "geom" column

                        while (dr.Read())
                        {
                            NaturalEarthRow row = new NaturalEarthRow();

                            using (BinaryReader binReader = new BinaryReader(dr.GetSqlBytes(geomCol.Index).Stream))
                            {
                                row.Geometry = new SqlGeometry();
                                row.Geometry.Read(binReader);
                            }
                            if (nameCol != null)
                            {
                                row.name = dr.GetString(nameCol.Index);
                            }

                            rows.Add(row);
                        }
                    }
                }
            }

            return(rows);
        }
		private static List<NaturalEarthRow> GetNaturalEarthTableRows(string tableName, string connectionString)
		{
			List<NaturalEarthRow> rows = new List<NaturalEarthRow>();
			using (SqlConnection con = new SqlConnection(connectionString))
			{
				con.Open();
				using (SqlCommand com = new SqlCommand(string.Format("SELECT * FROM [{0}]", tableName), con))
				{
					using (SqlDataReader dr = com.ExecuteReader())
					{
						List<ColInfo> colInfos = GetColumnsInfo(dr);
						ColInfo nameCol = FindColumnByNameOrType(colInfos, "name", "String"); // find first column named "name" or else first string column
						ColInfo geomCol = FindColumnByNameOrType(colInfos, "geom", null); // find first "geom" column

						while (dr.Read())
						{
							NaturalEarthRow row = new NaturalEarthRow();

							using (BinaryReader binReader = new BinaryReader(dr.GetSqlBytes(geomCol.Index).Stream))
							{
								row.Geometry = new SqlGeometry();
								row.Geometry.Read(binReader);
							}
							if (nameCol != null)
							{
								row.name = dr.GetString(nameCol.Index);
							}

							rows.Add(row);
						}
					}
				}
			}

			return rows;
		}