gpt4 book ai didi

date - ColdFusion 电子表格错误,日期或时间字符串无效

转载 作者:行者123 更新时间:2023-12-01 15:48:32 24 4
gpt4 key购买 nike

我正在尝试将查询导出到 Excel 文档。

这是我使用的代码:

<cfscript> 
//Use an absolute path for the files. --->
theDir=GetDirectoryFromPath(GetCurrentTemplatePath());
theFile=theDir & "invoicesDue.xls";
//Create an empty ColdFusion spreadsheet object. --->
theSheet = SpreadsheetNew("invoicesData");
//Populate the object with a query. --->
SpreadsheetAddRows(theSheet,invoicesDue);
</cfscript>

<!--- Write the sheet to a file --->
<cfspreadsheet action="write" filename="#theFile#" name="theSheet" sheetname="invoicesDue" overwrite=true>

我得到的错误是:

'' is an invalid date or time string. 

121: SpreadsheetAddRows(theSheet,invoicesDue);

问题是,我已经转储了我的查询并且在任何地方都看不到引号并且所有日期/时间单元格都填充了日期时间,例如“2011-03-31 00:00:00.0”或空字符串。

我想知道是否有其他人以前遇到过此错误,因为我看不出它的原因。

最佳答案

cfspreadsheet 不喜欢日期字段的空值。最后我用了:

CAST(emptyDate as varchar) 

这似乎是一个修复。

关于date - ColdFusion 电子表格错误,日期或时间字符串无效,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14377309/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com