Exemplo n.º 1
0
        /*
         * Method:		checkDatabaseConnection
         * Purpose:		checks if application is able to connect to the database and server
         * Parameters:	server name as a string, database name as a string, user name as a string, password as a string, int mode 1 - create ERP datasource 2 - create LYNQ datasource
         * Return:		bool
         */
        public static bool checkDatabaseConnection(string txtServer, string txtDatabase, string txtUserName, string txtPassword, int mode)
        {
            string connString = "Data Source = " + txtServer + "; Initial Catalog = " + txtDatabase + ";User ID=" + txtUserName + ";Password="******"ERP Database Connection successful", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    else
                    {
                        MessageBox.Show("LYNQ Database Connection successful", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
                return(true);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(false);
            }
        }
Exemplo n.º 2
0
        /*
         * Method:		checkDatabaseConnection
         * Purpose:		checks if application is able to connect to the database and server
         * Parameters:	server name as a string, database name as a string, user name as a string, password as a string, int mode 1 - create ERP datasource 2 - create LYNQ datasource
         * Return:		bool
         */
        public static ErrorInfo checkDatabaseConnection(string txtServer, string txtDatabase, string txtUserName, string txtPassword, int mode)
        {
            ErrorInfo result     = new ErrorInfo();
            string    connString = "Data Source = " + txtServer + "; Initial Catalog = " + txtDatabase + ";User ID=" + txtUserName + ";Password="******"Unable to connect to the database";

                return(result);
            }
        }