Soldato
- Joined
- 16 Nov 2003
- Posts
- 9,682
- Location
- On the pale blue dot
Hi guys. Here's a bit of pseudo-code:
As the result variable is defined within the catch block, it can't be used outside of it. I could get around this by putting all my code that uses the result data inside of the try block, but I think this isn't very elegant. How would you approach this?
Code:
try
{
result = ConnectToSql(query);
}
catch queryException
{
return queryException;
}
print result; // <- This fails