POST POST

APR
23
2016

FSharp.Data.SqlClient Type Provider Not Finding Tables

This one took me forever to figure out. I'm using the SqlProgrammabilityProvider from FSharp.Data.SqlClient to do some data work. However when I point the connection string at my databse it isn't able to generate any completions after Table

1
2
3
4
5
6
7
[<Literal>]
let connectionString = @"Data Source=localhost\SQL2014;Initial Catalog=Completions;Integrated Security=True;MultipleActiveResultSets=True;Timeout=360"
type Completions = SqlProgrammabilityProvider<connectionString>
let TagExists(projectId, tagNumber) =
let b = new Completions.dbo.Tables. //ugh, won't complete

I tried pointing it at different databases on the same server and it worked just fine. I finally remembered that one of the tables in the database made use of spatial types. I experimented by deleting the tables which made use of the coordinates and all of a sudden things started working!

Obviously deleting the table wasn't a great solution so I pulled in the required packages which I think are

1
2
Install-Package microsoft.SqlServer.Types
Install-Package System.Spatial

I was now able to access the tables as expected.


Simon Timms

Email Email
Web Web
Twitter Twitter
GitHub GitHub
RSS

Looking for someone else?

You can find the rest of the Western Devs Crew here.

© 2015 Western Devs. All Rights Reserved. Design by Karen Chudobiak, Graphic Designer