"Application Error" on SQLConnection.Open(), following a FolderBrowserDialog.ShowDialog()
-
Hello, In my winapp targetting .Net FW v2.0.50727, a SQLConnection.Open() is done following FolderBrowserDialog.ShowDialog(). On the SQLConnection.Open(), I get the following error: "Error in the application" stack trace ================ at System.Threading.TimerBase.AddTimerNative(Object state, UInt32 dueTime, UInt32 period, StackCrawlMark& stackMark) at System.Threading.TimerBase.AddTimer(TimerCallback callback, Object state, UInt32 dueTime, UInt32 period, StackCrawlMark& stackMark) at System.Threading.Timer.TimerSetup(TimerCallback callback, Object state, UInt32 dueTime, UInt32 period, StackCrawlMark& stackMark) at System.Threading.Timer..ctor(TimerCallback callback, Object state, Int32 dueTime, Int32 period) at System.Data.ProviderBase.DbConnectionPool.CreateCleanupTimer() at System.Data.ProviderBase.DbConnectionPool.Startup() at System.Data.ProviderBase.DbConnectionPoolGroup.GetConnectionPool(DbConnectionFactory connectionFactory) at System.Data.ProviderBase.DbConnectionFactory.GetConnectionPool(DbConnection owningObject, DbConnectionPoolGroup connectionPoolGroup) at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) at System.Data.SqlClient.SqlConnection.Open() at FolderBrowseAndSQLConnect.Form1.button2_Click(Object sender, EventArgs e) in E:\mybackup\FolderBrowseAndSQLConnect\FolderBrowseAndSQLConnect\Form1.cs:line 29 Please give suggestions to solve this problem. I run it on a "Win XP Professional SP3 Version 2002". Interestingly, this issue is not reproducible from other machines that have the same OS & .Net FW configuration. Thanks
-
Hello, In my winapp targetting .Net FW v2.0.50727, a SQLConnection.Open() is done following FolderBrowserDialog.ShowDialog(). On the SQLConnection.Open(), I get the following error: "Error in the application" stack trace ================ at System.Threading.TimerBase.AddTimerNative(Object state, UInt32 dueTime, UInt32 period, StackCrawlMark& stackMark) at System.Threading.TimerBase.AddTimer(TimerCallback callback, Object state, UInt32 dueTime, UInt32 period, StackCrawlMark& stackMark) at System.Threading.Timer.TimerSetup(TimerCallback callback, Object state, UInt32 dueTime, UInt32 period, StackCrawlMark& stackMark) at System.Threading.Timer..ctor(TimerCallback callback, Object state, Int32 dueTime, Int32 period) at System.Data.ProviderBase.DbConnectionPool.CreateCleanupTimer() at System.Data.ProviderBase.DbConnectionPool.Startup() at System.Data.ProviderBase.DbConnectionPoolGroup.GetConnectionPool(DbConnectionFactory connectionFactory) at System.Data.ProviderBase.DbConnectionFactory.GetConnectionPool(DbConnection owningObject, DbConnectionPoolGroup connectionPoolGroup) at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) at System.Data.SqlClient.SqlConnection.Open() at FolderBrowseAndSQLConnect.Form1.button2_Click(Object sender, EventArgs e) in E:\mybackup\FolderBrowseAndSQLConnect\FolderBrowseAndSQLConnect\Form1.cs:line 29 Please give suggestions to solve this problem. I run it on a "Win XP Professional SP3 Version 2002". Interestingly, this issue is not reproducible from other machines that have the same OS & .Net FW configuration. Thanks
-
Sorry for the delay, here's the code: private void button2_Click(object sender, EventArgs e) { try { string connStr = ""; if (string.IsNullOrEmpty(txtUser.Text) && string.IsNullOrEmpty(txtPswd.Text)) connStr = String.Format("Data Source={0};Integrated Security=SSPI",txtSQLServer.Text); else connStr = String.Format("Data Source={0};user id={1};password={2}", txtSQLServer.Text,txtUser.Text,txtPswd.Text); SqlConnection sqlConn = new SqlConnection(connStr); sqlConn.Open(); MessageBox.Show("succesfully queried databases"); sqlConn.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
-
Sorry for the delay, here's the code: private void button2_Click(object sender, EventArgs e) { try { string connStr = ""; if (string.IsNullOrEmpty(txtUser.Text) && string.IsNullOrEmpty(txtPswd.Text)) connStr = String.Format("Data Source={0};Integrated Security=SSPI",txtSQLServer.Text); else connStr = String.Format("Data Source={0};user id={1};password={2}", txtSQLServer.Text,txtUser.Text,txtPswd.Text); SqlConnection sqlConn = new SqlConnection(connStr); sqlConn.Open(); MessageBox.Show("succesfully queried databases"); sqlConn.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
-
You're getting the Application Error on sqlConn.Open, and only on that specific machine? How does the connection-string look when you debug the application?
I are Troll :suss:
Answer to Q#1.1: Yes the application error is on sqlConn.Open. Answer to Q#1.2: Yes, this is reproducible only on some machines. Answer to Q#2: connection string looks like this - "Data Source=computer-88\\sqlexpress;Integrated Security=SSPI"
-
Answer to Q#1.1: Yes the application error is on sqlConn.Open. Answer to Q#1.2: Yes, this is reproducible only on some machines. Answer to Q#2: connection string looks like this - "Data Source=computer-88\\sqlexpress;Integrated Security=SSPI"
Looks good, doesn't seem to be a problem with the code. It was on a specific machine? Could there be another application running that's using the same port as SQL Express? You might want to try to connect over IP, using the default port-settings. If it helps, we'll have a clue where to look next :)
I are Troll :suss: