SQLProvider

SQL Provider for MSAccess

MSAccess is based on System.Data.OleDb. Use ACE drivers for databases > Access 2007 (with .accdb extension). For databases < 2007 (with .mdb extension), JET drivers can be used, although ACE will also work.

http://www.microsoft.com/download/en/confirmation.aspx?id=23734

Parameters

ConnectionString

A connection string used to connect to Microsoft Access instance; typical connection strings for the driver apply here. See (MSAccess Connection Strings Documentation) [] for a complete list of connection string options.

//TODO: link to reference

[<Literal>]
let connectionString1 = "Provider=Microsoft.ACE.OLEDB.12.0; Data Source= " +  __SOURCE_DIRECTORY__ + @"..\..\..\files\msaccess\Northwind.accdb"

[<Literal>]
let connectionString2 = 
    "Provider=Microsoft.Jet.OLEDB.4.0; Data Source= " +
    __SOURCE_DIRECTORY__ + 
    @"..\..\..\files\msaccess\Northwind.mdb"

ConnectionStringName

Instead of storing the connection string in the source code / fsx script, you can store values in the App.config file. This is the name of the connectionString key/value pair stored in App.config (TODO: confirm file name).

// found in App.config (TODO:confirm)
let connexStringName = "DefaultConnectionString"

DatabaseVendor

From the FSharp.Data.Sql.Common.DatabaseProviderTypes enumeration. For MSAccess, use Common.DatabaseProviderTypes.MSACCESS.

let dbVendor = FSharp.Data.Sql.Common.DatabaseProviderTypes.MSACCESS

ResolutionPath

Path to search for assemblies containing database vendor-specific connections and custom types. Type the path where Npgsql.Data.dll is stored.

[<Literal>]
let resolutionPath = __SOURCE_DIRECTORY__

IndividualsAmount

Sets the count to load for each individual. See (individuals)[individuals.html] for further info.

[<Literal>]
let useOptTypes = true


#r "FSharp.Data.SqlProvider.dll"
open FSharp.Data.Sql

//type accdb = SqlDataProvider<Common.DatabaseProviderTypes.MSACCESS , connectionString1, ResolutionPath=resolutionPath >
//let accdbctx = accdb.GetDataContext()
//
//let accdbcustomers = accdbctx.Northwind.Customers|> Seq.toArray

type mdb = SqlDataProvider<Common.DatabaseProviderTypes.MSACCESS, connectionString2, ResolutionPath=resolutionPath, UseOptionTypes=useOptTypes >
let mdbctx = mdb.GetDataContext()

let mdbcustomers = 
    mdbctx.Northwind.Customers 
    |> Seq.map(fun c -> 
        c.ColumnValues |> Seq.toList) 
    |> Seq.toList
Multiple items
type LiteralAttribute = inherit Attribute new: unit -> LiteralAttribute

--------------------
new: unit -> LiteralAttribute
[<Literal>] val connectionString1: string = "Provider=Microsoft.ACE.OLEDB.12.0; Data Source= C:\git\SQLProvider\docs\content\core..\..\..\files\msaccess\Northwind.accdb"
[<Literal>] val connectionString2: string = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source= C:\git\SQLProvider\docs\content\core..\..\..\files\msaccess\Northwind.mdb"
val connexStringName: string
val dbVendor: FSharp.Data.Sql.Common.DatabaseProviderTypes
Multiple items
namespace FSharp

--------------------
namespace Microsoft.FSharp
Multiple items
namespace FSharp.Data

--------------------
namespace Microsoft.FSharp.Data
namespace FSharp.Data.Sql
namespace FSharp.Data.Sql.Common
[<Struct>] type DatabaseProviderTypes = | MSSQLSERVER = 0 | SQLITE = 1 | POSTGRESQL = 2 | MYSQL = 3 | ORACLE = 4 | MSACCESS = 5 | ODBC = 6 | FIREBIRD = 7 | MSSQLSERVER_DYNAMIC = 8 | MSSQLSERVER_SSDT = 9 | DUCKDB = 10
FSharp.Data.Sql.Common.DatabaseProviderTypes.MSACCESS: FSharp.Data.Sql.Common.DatabaseProviderTypes = 5
[<Literal>] val resolutionPath: string = "C:\git\SQLProvider\docs\content\core"
[<Literal>] val useOptTypes: bool = true
type mdb = obj
type SqlDataProvider
<summary>Typed representation of a database</summary> <param name='ConnectionString'>The connection string for the SQL database</param> <param name='ConnectionStringName'>The connection string name to select from a configuration file</param> <param name='DatabaseVendor'> The target database vendor</param> <param name='IndividualsAmount'>The amount of sample entities to project into the type system for each SQL entity type. Default 50. Note GDPR/PII regulations if using individuals with ContextSchemaPath.</param> <param name='UseOptionTypes'>If set, F# option types will be used in place of nullable database columns. If not, you will always receive the default value of the column's type even if it is null in the database.</param> <param name='ResolutionPath'>The location to look for dynamically loaded assemblies containing database vendor specific connections and custom types. Types used in desing-time: If no better clue, prefer .NET Standard 2.0 versions. Semicolon to separate multiple.</param> <param name='Owner'>Oracle: The owner of the schema for this provider to resolve. PostgreSQL: A list of schemas to resolve, separated by spaces, newlines, commas, or semicolons.</param> <param name='CaseSensitivityChange'>Should we do ToUpper or ToLower when generating table names?</param> <param name='TableNames'>Comma separated table names list to limit a number of tables in big instances. The names can have '%' sign to handle it as in the 'LIKE' query (Oracle and MSSQL Only)</param> <param name='ContextSchemaPath'>The location of the context schema previously saved with SaveContextSchema. When not empty, will be used to populate the database schema instead of retrieving it from then database.</param> <param name='OdbcQuote'>Odbc quote characters: Quote characters for the table and column names: `alias`, [alias]</param> <param name='SQLiteLibrary'>Use System.Data.SQLite or Mono.Data.SQLite or select automatically (SQLite only)</param> <param name='SsdtPath'>A path to an SSDT .dacpac file.'</param>
Common.DatabaseProviderTypes.MSACCESS: Common.DatabaseProviderTypes = 5
val mdbctx: obj
val mdbcustomers: obj list list
Multiple items
module Seq from FSharp.Data.Sql

--------------------
module Seq from Microsoft.FSharp.Collections
val map: mapping: ('T -> 'U) -> source: 'T seq -> 'U seq
val c: obj
val toList: source: 'T seq -> 'T list

Type something to start searching.