I have a try catch statement and when the code goes to throw the exception, it will not run past this point.
I press F5/F10 and the code keeps running the same line of code.
Is this to do with a setting in VS2012?
Calling code:
if (!string.IsNullOrEmpty(connections.xmlconSIPPPremium))
{
try
{
DataTable dt = GetUtilityFiles(connections.xmlconSIPPPremium);
foreach (DataRow dr in dt.Rows)
{
File.WriteAllBytes(_rootDirectory + @"\" + dr["UtilityName"], (byte[])dr["UtilityBytes"]);
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
else if (!string.IsNullOrEmpty(connections.xmlconSSASPremium))
{
try
{
DataTable dt = GetUtilityFiles(connections.xmlconSSASPremium);
foreach (DataRow dr in dt.Rows)
{
File.WriteAllBytes(_rootDirectory + @"\" + dr["UtilityName"], (byte[])dr["UtilityBytes"]);
}
}
catch(Exception ex)
{
MessageBox.Show(ex.Message);
}
}
}
Issue:
private DataTable GetUtilityFiles(string strCon)
{
DataTable dt = new DataTable();
using (SqlConnection con = new SqlConnection(strCon))
{
try
{
using (SqlCommand cmd = new SqlCommand("[dmm].[vertUtility_Select]", con))
{
SqlDataAdapter sda = new SqlDataAdapter(cmd);
sda.Fill(dt);
}
}
catch (Exception ex)
{
throw;
}
return dt;
}
}
Thanks!