namespace GNMS { public class Godaddy { //singleton has a reference to itself private static Godaddy dbconec; private Godaddy() { }//private constructor so that it cannot be instantiated outside this class //grabs instance of singleton pattern public static Godaddy GetInstance() { if (dbconec == null) //check if an instance has been created else can create a new instance { dbconec = new Godaddy(); } return dbconec; } public string connectDB() //Database connection { try { //create a string connection string strconnection; strconnection = "Server=x.x.x.x; Database =xxx; Uid = xxx; Password =xxx;CharSet=utf8; Connect Timeout=60;"; //initialize the connection to DB MySqlConnection conn = new MySqlConnection(strconnection); conn.Open(); return strconnection; //conn.Close(); } catch (Exception ex) { return ex.Message; } } //// } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)