I thought that if there is an error between the 'try' it would execute the 'catch'? Below is my code and its seems its not catching the error on the TestConnection.Open();
try
{
SqlConnection TestConnection = new SqlConnection();
TestConnection.ConnectionString = @"Server=hpw7v64.ggamvpn.gbridge.net;Database=IPDev;User ID=**********;Password=**********;";
TestConnection.Open(); //<<
//
SqlDataAdapter TestDataAdapter = new SqlDataAdapter("SELECT * FROM [User]", TestConnection);
DataSet TestDataSet = new DataSet();
//
TestDataAdapter.Fill(TestDataSet);
dataGridViewMSSQLHP.DataSource = TestDataSet.Tables[0];
dataGridViewMSSQLHP.Refresh();
}
catch (SqlException SQLExecute)
{
MessageBox.Show("Connection failed...MSSQL HP" + SQLExecute, "Test Connection...", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
theLizardPosted Mar 5, 2010, 2:39 AM
with catch(Exception e)
GBridge does things I do not like.
search for 'NAT Detection' so that you may better understand my concerns.
theLizardPosted Mar 5, 2010, 3:05 AM
GustavoPosted Mar 5, 2010, 3:02 AM
Yep... I was planning to just say: 'Not able to connect to server: XXXXXX.'. The detail stuff is just for testing.
theLizardPosted Mar 5, 2010, 2:57 AM
For testing purpose it is ok to show detailed error messages, but in release versions of your software, it is best not to because if you have vulnerabilities to sql injection attacks detailed messages may give hackers information that would allow a breach of your security.
GustavoPosted Mar 5, 2010, 2:49 AM
Thanks... it worked.
GustavoPosted Mar 5, 2010, 2:33 AM
What is a 'general exception'. Can you give me a code example?
GBridge: YES, you have me worried now. I will remove it and change the code to look for my internal workgroup network.
theLizardPosted Mar 5, 2010, 2:24 AM
But try a general exception to see if that catches and let me know the result.
On the previous issue you asked, I would uninstall gbridge, I would not trust it at all.