示例#1
0
 public bool CheckDataBaseConnection(Form pParentForm, string sTitle)
 {
     if (IsValidDataBaseConnectionString())
     {
         if (m_DBType == eDBType.SQLITE)
         {
             if (File.Exists(m_conData_SQLITE.DataBaseFile))
             {
                 TestConnectionForm tConForm = new TestConnectionForm(pParentForm, this, true, true, sTitle);
                 if (pParentForm != null)
                 {
                     tConForm.TopMost = pParentForm.TopMost;
                 }
                 if (tConForm.ShowDialog(pParentForm) == DialogResult.OK)
                 {
                     tConForm.Dispose();
                     return true;
                 }
                 else
                 {
                     tConForm.Dispose();
                     return false;
                 }
             }
             else
             {
                 return false;
             }
         }
         else
         {
             TestConnectionForm tConForm = new TestConnectionForm(pParentForm, this, true, true, sTitle);
             if (pParentForm != null)
             {
                 tConForm.TopMost = pParentForm.TopMost;
             }
             if (tConForm.ShowDialog(pParentForm) == DialogResult.OK)
             {
                 tConForm.Dispose();
                 return true;
             }
             else
             {
                 tConForm.Dispose();
                 return false;
             }
         }
     }
     else
     {
         return false;
     }
 }
        private void Btn_TestConnection_Click(object sender, EventArgs e)
        {
            UpdateConData();

            TestConnectionForm tConForm = new TestConnectionForm(m_ParentForm,m_SQL_Connection,  false, true, m_Title);
            tConForm.TopMost = this.TopMost;
            if (tConForm.ShowDialog() == DialogResult.OK)
            {
            //                MessageBox.Show(this, lngConn.s_ConnectionOK.s, "OK");
            }
            else
            {

            }
        }