コード例 #1
0
        public static GetServerDBDetails dbDetails()
        {
            if (myIntance == null)
            {
                myIntance = new GetServerDBDetails();
            }

            return(myIntance);
        }
コード例 #2
0
        public static String isConnectionAvalable()
        {
            GetServerDBDetails dbdetails = GetServerDBDetails.dbDetails();


            using (SqlConnection connection = new SqlConnection("Data Source='" + dbdetails._server + "';Initial Catalog='" + dbdetails._dbName + "';User ID='" + dbdetails._username + "';Password='******'"))
            {
                connection.Open();

                if (connection.State == ConnectionState.Open)
                {
                    //MessageBox.Show("");
                }
                connection.Close();
                if (connection.State == ConnectionState.Closed)
                {
                    //MessageBox.Show("");
                }
            }

            return(null);
        }