Exemplo n.º 1
0
        private void btnConnect_Click(object sender, EventArgs e)
        {
            string strDB = @"Persist Security Info=False;Initial Catalog=" + this.txtDBName.Text.Trim() + ";Data Source=" + this.txtServerName.Text.Trim() + ";User ID=" + this.txtLogin.Text.Trim() + ";Password="******"Database Connected !!"); this.Close();
            }
            catch
            {
                NP.MSGB(NP_Cls.NPMgsStyle.ErrorType, "Can not Connect Database, Try Again !!"); return;
            }
            finally
            {
                if (oConn.State == ConnectionState.Open)
                {
                    oConn.Close();
                }
            }
        }