Witam mam problem, probuje pobrac z bazy danych do jednej listy miasta a do drugiej ulice jednak wyskakuje mi blad..
static void Main(string[] args)
{
try
{
ClientDatabase1Entities db = new ClientDatabase1Entities();
var city = (from City in db.Clients select City).ToList();
List<string> City1 = city.ConvertAll(x => Convert.ToString(x));
var street = (from Street in db.Clients select Street).ToList();
List<string> Street1 = street.ConvertAll(x => Convert.ToString(x));
for (int i = 0; i < Street1.Count; i++)
{
//Google Api
string urlgps = string.Format("https://maps.googleapis.com/maps/api/geocode/json?address={0}+{1}&key={2}", City1[i], Street1[i], googleapikeygps);
WebClient client1 = new WebClient();
string weather = client1.DownloadString(urlgps);
WeatherItemclass weateritem1 = JsonConvert.DeserializeObject<WeatherItemclass>(weather);
string lat = Convert.ToString(weateritem1.results[0].geometry.location.lat);
string lng = Convert.ToString(weateritem1.results[0].geometry.location.lng);
string convertlat = lat.Replace(',', '.');
string convertlng = lng.Replace(',', '.');
//Weather Api
string url = string.Format("http://api.openweathermap.org/data/2.5/forecast/daily?lat={0}&lon={1}&units=metric&cnt=1&APPID={2}", convertlat, convertlng, weatherapikey);
WebClient client2 = new WebClient();
string dataweatherjson = client2.DownloadString(url);
string datajson = dataweatherjson;
}
}
catch (Exception ex)
{
Console.WriteLine("Can not open connection! Exception: {0}", ex);
Console.ReadLine();
}
dodam tez screena z baza