Closed FedericoBinda closed 6 years ago
"Main" is just the schema for the database (SQLite) used in the example. Your database could have one or more different schemas - for Sql Server, it should be "dbo" by default.
On Thu, Aug 23, 2018, 12:49 FedericoBinda notifications@github.com wrote:
Hi
I am trying to use SQLProvider to do operations on a MSSQL database on Docker on my Mac. I have followed the basic procedures from the webpage, and my code works up to the point where I call GetDataContext. When I try to use the data context, I get the following error: "error FS0039: The field, constructor or member 'Main' is not defined”.
I work with Visual Studio Code, and the SQLProvider library I use is version 1.1.48. Below I paste the information about the server and the code that I am using.
Thanks.
Federico
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 7aa8fb7275a6 microsoft/mssql-server-linux:2017-latest "/opt/mssql/bin/sqls…" 3 days ago Up 5 seconds 0.0.0.0:1433->1433/tcp test1
r "../packages/SQLProvider/lib/net451/FSharp.Data.SqlProvider.dll"
open FSharp.Data.Sql let [
] dbVendor = Common.DatabaseProviderTypes.MSSQLSERVER let [ ] connString = "Server=localhost;Database=mydb;User Id=SA;Password=Password1" let [ ] indivAmount = 1000 let [ ] useOptTypes = true // // Create a type that handles the database // type sql = SqlDataProvider< dbVendor, connString, IndividualsAmount = indivAmount, UseOptionTypes = useOptTypes>
let ctx = sql.GetDataContext() let customers = ctx.Main.Customers |> Seq.toArray
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/fsprojects/SQLProvider/issues/570, or mute the thread https://github.com/notifications/unsubscribe-auth/ALtja0oozjB-yegok34SUoTIYFAPTDqAks5uToihgaJpZM4WJSVI .
I am not sure how docker works in this context, is the "localhost" connection string definitely correct? Can you open a normal ADO.NET SqlConnection and connect successfully with a F#/C# console project?
@piaste: Thanks, that worked. Now I can see the database. @pezipink: Apparently it works. To create the database I followed the instructions from https://docs.microsoft.com/en-us/sql/linux/quickstart-install-connect-docker?view=sql-server-linux-2017
Hi
I am trying to use SQLProvider to do operations on a MSSQL database on Docker on my Mac. I have followed the basic procedures from the webpage, and my code works up to the point where I call GetDataContext. When I try to use the data context, I get the following error: "error FS0039: The field, constructor or member 'Main' is not defined”.
I work with Visual Studio Code, and the SQLProvider library I use is version 1.1.48. Below I paste the information about the server and the code that I am using.
Thanks.
Federico