public static DbUtilMSSQL GetSingleton(string server, string database, string uid, string passwd)
        {
            if (mSingleton == null)
            {
                mSingleton = new DbUtilMSSQL();
                mSingleton.Connect(server, database, uid, passwd);
            }

            return(mSingleton);
        }
Example #2
0
        private void btnMSTestConnection_Click(object sender, EventArgs e)
        {
            DbUtilMSSQL util = new DbUtilMSSQL();

            util.Connect(tbMSHostname.Text + "," + tbMSPort.Text,
                         tbMSDatabase.Text, tbMSUser.Text, tbMSPassword.Text);
            TestConnectionForm form = new TestConnectionForm();

            if (util.IsConnected && util.DatabaseExist(tbMSDatabase.Text))
            {
                form.SetText("Connection successfull.");
                form.SetDetails(util.ConnectionInfo);
            }
            else
            {
                form.SetText("Connection failed.");
                form.SetDetails(util.ConnectionInfo);
            }
            form.Show();
            util.Dispose();
        }