ConnectMySql() 공개 메소드

public ConnectMySql ( string server, string user, string password ) : void
server string
user string
password string
리턴 void
예제 #1
0
 /// <summary>
 /// Connect to a MySQL database.
 /// This must be called before any SQL methods.
 /// The MySQL service must be running and database with credentials already created, if in doubt use SQLite.
 /// </summary>
 /// <param name="server">The MySQL server (e.g. "localhost").</param>
 /// <param name="user">The MySQL user name.</param>
 /// <param name="password">The MySQL user password.</param>
 /// <param name="database">The MySQL database name.</param>
 /// <returns>A label to identify the database.</returns>
 public static Primitive ConnectMySQL(Primitive server, Primitive user, Primitive password, Primitive database)
 {
     try
     {
         ExtractDll();
         DataBase dataBase = GetDataBase(database, false);
         if (null == dataBase)
         {
             dataBase = new DataBase(database, NextID());
             dataBase.ConnectMySql(server, user, password);
         }
         dataBases.Add(dataBase);
         return(dataBase.name);
     }
     catch (Exception ex)
     {
         Utilities.OnError(Utilities.GetCurrentMethod(), ex);
     }
     return("");
 }
예제 #2
0
파일: DataBase.cs 프로젝트: litdev1/LitDev
 /// <summary>
 /// Connect to a MySQL database.
 /// This must be called before any SQL methods.
 /// The MySQL service must be running and database with credentials already created, if in doubt use SQLite.
 /// </summary>
 /// <param name="server">The MySQL server (e.g. "localhost").</param>
 /// <param name="user">The MySQL user name.</param>
 /// <param name="password">The MySQL user password.</param>
 /// <param name="database">The MySQL database name.</param>
 /// <returns>A label to identify the database.</returns>
 public static Primitive ConnectMySQL(Primitive server, Primitive user, Primitive password, Primitive database)
 {
     try
     {
         ExtractDll();
         DataBase dataBase = GetDataBase(database, false);
         if (null == dataBase)
         {
             dataBase = new DataBase(database, NextID());
             dataBase.ConnectMySql(server, user, password);
         }
         dataBases.Add(dataBase);
         return dataBase.name;
     }
     catch (Exception ex)
     {
         Utilities.OnError(Utilities.GetCurrentMethod(), ex);
     }
     return "";
 }