为什么我会收到"根据此程序点之前的信息查找不确定类型的对象......"的错误.
我已经注释了类型信息.
它突出了代码r.Read().
let rec foldResult myFunc accumulator r:SqlDataReader =
if r.Read() then
foldResult myFunc (myFunc 123456 accumulator) r:SqlDataReader
else
accumulator
Run Code Online (Sandbox Code Playgroud) 这似乎有效,但看起来很笨重.有没有更好的方法来编码?
// Hunting for the best index to use for a data compare
let getIndex connDB strTable =
match getIndexByPrimaryKey connDB strTable with
| Some(name) -> Some(name)
| None ->
match getIndexByCluster connDB strTable with
| Some(name) -> Some(name)
| None ->
match getIndexByFirstColumns connDB strTable with
| Some(name) -> Some(name)
| None ->
match getIndexByOnlyUnique connDB strTable with
| Some(name) -> Some(name)
| None ->
match getAnyUniqueIndex connDB strTable with
| Some(name) -> Some(name)
| None -> None
Run Code Online (Sandbox Code Playgroud)