- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我已经使用FSharp.Data.TypeProvider多次,但这是我第一次遇到此错误。我能够毫无问题地连接到SQL数据库,并且还可以运行查询,但是当我尝试使用任何Seq时。函数(例如|> Seq.toArray),出现超时过期错误。
type dbSchema = SqlDataConnection<DBString, Views = false, Functions = false, StoredProcedures = false>
let db = dbSchema.GetDataContext()
type dbSchema =
class
static member GetDataContext : unit -> edbSchema.ServiceTypes.SimpleDataContextTypes.dbTableOutput
+ 1 overload
nested type ServiceTypes
end
let query1 =
let q = query { for a in db.Products do
select (a.Date,a.PId, a.Tax)}
q |> Seq.map (fun (a,b,c) -> (a,b,c))
val query1: seq<DateTime * Nullable<int> * float>
query1 |> Seq.head
System.Data.SqlClient.SqlException (0x80131904): Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding. ---> System.ComponentModel.Win32Exception (0x80004005): The wait operation timed out
at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
at System.Data.SqlClient.SqlDataReader.TryCloseInternal(Boolean closeReader)
at System.Data.SqlClient.SqlDataReader.Close()
at System.Data.Linq.SqlClient.ObjectReaderCompiler.ObjectReaderSession`1.Dispose()
at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.Dispose()
at Microsoft.FSharp.Collections.SeqModule.Head[T](IEnumerable`1 source)
at <StartupCode$FSI_0007>.$FSI_0007.main@()
ClientConnectionId:6b4036ff-6ef4-4224-ad7a-08f8b4808b1b
Stopped due to error
When you use a query expression, you must remember that the query is subject to lazy evaluation. Therefore, the database is still open for reading during any chained evaluations, such as in the lambda expression blocks after each query expression. Any database operation that explicitly or implicitly uses a transaction must occur after the read operations have completed.
最佳答案
除了将查询强制到列表之外,您还可以在连接字符串中指定超时,例如Connection Timeout = 60
。您还可以尝试使用datacontext进行其他操作,例如:
db.DataContext.ObjectTrackingEnabled <- false
db.DataContext.CommandTimeout <- 90
关于f# - FSharp.Data.TypeProviders SQLDataConnection,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27267132/
使用 SqlDataConnection 类型提供程序的正常方法如下: type dbSchema = SqlDataConnection let db = dbSchema.GetDataConte
我已经使用FSharp.Data.TypeProvider多次,但这是我第一次遇到此错误。我能够毫无问题地连接到SQL数据库,并且还可以运行查询,但是当我尝试使用任何Seq时。函数(例如|> Seq.
从现有的 SQL Server 数据库且没有 EF 模型开始,是否有任何理由比 SqlDataConnection 更青睐 SqlEntityConnection 类型提供程序? 最佳答案 您可以升级
我在 SQL 数据库中有一个表,其中包含一个计算列,如下所示: CREATE TABLE MyTable ( Rate decimal(10,5) NOT NULL, Quantity int
我正在 Win 8 CP 中的 VS 11 Beta 中使用新的 F# 类型提供程序,但我无法说服 SqlDataConenction 类型提供程序使用 SqlCe 数据库。编码: open Syst
我正在使用类型表达式: type dbSchema = SqlDataConnection 这在编译时效果很好(我可以完全访问所有 db 类型),但在运行时失败。我认为这是因为控制台应用程序的 bin
我想使用 F# 3.0 编程语言的一项新功能:类型提供程序。我尝试使用 F# 3.0 类型提供程序 SqlDataConnection 连接到本地计算机上的 Microsoft Access 数据库
我是一名优秀的程序员,十分优秀!