Esempio n. 1
0
        public static void Default_CheckDB(HtmlGenericControl msg)
        {
            // see if the connection string works
            try
            {
                // Intentionally getting an extra connection here so that we fall into the right "catch"
                SqlConnection conn = DbUtil.get_sqlconnection();
                conn.Close();

                try
                {
                    DbUtil.execute_nonquery("select count(1) from users");
                }
                catch (SqlException e1)
                {
                    Util.write_to_log(e1.Message);
                    Util.write_to_log(Util.get_setting("ConnectionString", "?"));
                    msg.InnerHtml = "Unable to find \"bugs\" table.<br>"
                                    + "Click to <a href=install.aspx>setup database tables</a>";
                }
            }
            catch (SqlException e2)
            {
                msg.InnerHtml = "Unable to connect.<br>"
                                + e2.Message + "<br>"
                                + "Check Web.config file \"ConnectionString\" setting.<br>"
                                + "Check also README.html<br>"
                                + "Check also <a href=http://sourceforge.net/projects/btnet/forums/forum/226938>Help Forum</a> on Sourceforge.";
            }
        }