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