mariechristine
01-16-2004, 04:10 AM
suppose i have a for loop as shown below. Suppose for i=0, reading the url will result in an operation time out. When that occurs i want the execution to continue the loop for the next i despite the exception. How is that done?
for (int i=0; i<2; i++)
{
//retrieve genus and species
genus=this.dsetFish.FISH.Rows[i]["Genus"].ToString();
species=this.dsetFish.FISH.Rows[i]["Species"].ToString();
System.Net.WebClient client = new System.Net.WebClient();
System.IO.Stream data;
try
{
data = client.OpenRead("http://202.123.56.178//summary//SpeciesSummary.asp?genus=" + genus + "&species=" + species + "");
}
catch(Exception exc)
{
MessageBox.Show(exc.Message);
throw exc ;
}
}
for (int i=0; i<2; i++)
{
//retrieve genus and species
genus=this.dsetFish.FISH.Rows[i]["Genus"].ToString();
species=this.dsetFish.FISH.Rows[i]["Species"].ToString();
System.Net.WebClient client = new System.Net.WebClient();
System.IO.Stream data;
try
{
data = client.OpenRead("http://202.123.56.178//summary//SpeciesSummary.asp?genus=" + genus + "&species=" + species + "");
}
catch(Exception exc)
{
MessageBox.Show(exc.Message);
throw exc ;
}
}