/// <summary> /// Connect to a SqlServer database. /// This must be called before any SQL methods. /// The SqlServer service must be running and database with credentials already created, if in doubt use SQLite. /// </summary> /// <param name="server">The SqlServer server (e.g. "(local)\SQLEXPRESS").</param> /// <param name="database">The SqlServer database name.</param> /// <returns>A label to identify the database.</returns> public static Primitive ConnectSqlServer(Primitive server, Primitive database) { try { ExtractDll(); DataBase dataBase = GetDataBase(database, false); if (null == dataBase) { dataBase = new DataBase(database, NextID()); dataBase.ConnectSqlServer(server); } dataBases.Add(dataBase); return(dataBase.name); } catch (Exception ex) { Utilities.OnError(Utilities.GetCurrentMethod(), ex); } return(""); }
/// <summary> /// Connect to a SqlServer database. /// This must be called before any SQL methods. /// The SqlServer service must be running and database with credentials already created, if in doubt use SQLite. /// </summary> /// <param name="server">The SqlServer server (e.g. "(local)\SQLEXPRESS").</param> /// <param name="database">The SqlServer database name.</param> /// <returns>A label to identify the database.</returns> public static Primitive ConnectSqlServer(Primitive server, Primitive database) { try { ExtractDll(); DataBase dataBase = GetDataBase(database, false); if (null == dataBase) { dataBase = new DataBase(database, NextID()); dataBase.ConnectSqlServer(server); } dataBases.Add(dataBase); return dataBase.name; } catch (Exception ex) { Utilities.OnError(Utilities.GetCurrentMethod(), ex); } return ""; }