我看过这篇SO post和类似的文章。我有一个更简单的问题,即获得select count(*)
的结果。
我通过将它们存储在MS Access数据库中来跟踪文件名和日期。我可以通过对数据库执行select count(*)
来确定我是否已经在数据库中添加了文件名和日期,如下所示:
let query = "select count(*) from ReportProcessedStatus
where ReportDate = #" + report_date + "#
and ReportFileName = '" + fn + "'"
我的cmd.ExecuteReader ()
成功,但我无法弄清楚如何从读者中获取伯爵的价值。
let reg_fnam_template = "arrgster*"
let ADOCon = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0; Data Source=.\Munis_To_InvoiceCloud.mdb")
ADOCon.Open ()
let dir_list = Directory.GetFiles(spool_dir, reg_fnam_template)
for fn in dir_list do
printfn "Working on Munis Extract File: %A " (Path.GetFileName(fn))
let query = "select count(*) from ReportProcessedStatus where ReportDate = #" + report_date + "# and ReportFileName = '" + fn + "'"
use cmd = new OleDbCommand(query , ADOCon)
let sql_reader = cmd.ExecuteReader ()
let row_read_OK = sql_reader.Read ()
所有这些代码都有效,执行后row_read_OK为真。