无法正确格式化日期字段 [英] Cannot get to format the date field correctly yet

查看:76
本文介绍了无法正确格式化日期字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我无法在动态sql语句中正确获取日期格式,之后

尝试各种方式处理它。我需要一些关于日期格式的帮助

以下动态sql语句。提前感谢任何帮助。

运行asp页面时,我仍然收到错误

错误类型:

Microsoft VBScript运行时( 0x800A000D)

类型不匹配:''格式''


DYNAMIC SQL语句:

sql =" INSERT INTO tblExpense(ENO,EntryDate,ContractedServiceExpense,"

sql = sql&" TravelExpense,PersonnelExpense)"

sql = sql& " VALUES(''"& l_ENO&"''','& Format(l_Date,

" \#mm \ / dd \ / yyyy \#" ;&","& l_contractedserviceexpense&","

& l_travelexpense&","& l_personnelexpense&")"

解决方案

您的格式化功能是什么样的?你用什么样的数据库?
使用?


看看这里的功能。 http://www.aspfaq.com/show.asp?id= 2313


Ray在工作


" Jack" < JA ** @ discussions.microsoft.com>在留言中写道

news:62 ********************************** @ microsof t.com ...


在尝试各种处理方式后,我无法在动态sql语句中正确获取日期格式。我在以下动态sql语句中需要一些日期格式
的帮助。提前感谢任何帮助。
运行asp页面时,我仍然收到错误
错误类型:
Microsoft VBScript运行时(0x800A000D)
类型不匹配:''格式''

DYNAMIC SQL语句:
sql =" INSERT INTO tblExpense(ENO,EntryDate,ContractedServiceExpense,
" sql = sql&" TravelExpense,PersonnelExpense)"
sql = sql& " VALUES(''"& l_ENO&"'',&& Format(l_Date,
" \#mm \ / dd \ / yyyy \#")& ","& l_contractedserviceexpense&","
& l_travelexpense&","& l_personnelexpense&")"


VBScript中没有格式,抱歉。请停止使用模糊的

格式,如mm / dd / yyyy。 http://www.aspfaq.com/2023

-

请发布DDL,样本数据和所需结果。

参见 http://www.aspfaq.com/5006 获取信息。


" Jack" < JA ** @ discussions.microsoft.com>在留言中写道

news:62 ********************************** @ microsof t.com ...


在尝试各种处理方式后,我无法在动态sql语句中正确获取日期格式。我在以下动态sql语句中需要一些日期格式
的帮助。提前感谢任何帮助。
运行asp页面时,我仍然收到错误
错误类型:
Microsoft VBScript运行时(0x800A000D)
类型不匹配:''格式''

DYNAMIC SQL语句:
sql =" INSERT INTO tblExpense(ENO,EntryDate,ContractedServiceExpense,
" sql = sql&" TravelExpense,PersonnelExpense)"
sql = sql& " VALUES(''"& l_ENO&"'',&& Format(l_Date,
" \#mm \ / dd \ / yyyy \#")& ","& l_contractedserviceexpense&","
& l_travelexpense&","& l_personnelexpense&")"


Ray,

我在后端使用访问权限。我的问题是弄清楚如何操作日期变量
,以便response.write sql返回日期为

#10/01/2005#。我现在得到它的方式,它不允许response.write

语句工作。此时我并不关心任何日期格式,而是通过在日期中添加分隔符来使sql语句正常工作。

谢谢。问候。


" Jack"写道:


在尝试各种处理方式后,我无法在动态sql语句中正确获取日期格式。我需要一些关于日期格式的帮助,以下是动态的sql语句。提前感谢任何帮助。
运行asp页面时,我仍然收到错误
错误类型:
Microsoft VBScript运行时(0x800A000D)
类型不匹配:''格式''

DYNAMIC SQL语句:
sql =" INSERT INTO tblExpense(ENO,EntryDate,ContractedServiceExpense,"
sql = sql&" TravelExpense,PersonnelExpense)"
sql = sql& " VALUES(''"& l_ENO&"'',&& Format(l_Date,
" \#mm \ / dd \ / yyyy \#")& ","& l_contractedserviceexpense&","
& l_travelexpense&","& l_personnelexpense&")"


Hi,
I cannot get the date format correctly in dynamic sql statement, after
trying various ways of handling it. I need some help with the date format in
the following dynamic sql statement. Any help is appreciated in advance.
While running the asp page, I still get an error as
Error Type:
Microsoft VBScript runtime (0x800A000D)
Type mismatch: ''Format''

DYNAMIC SQL STATEMENT:
sql = " INSERT INTO tblExpense (ENO, EntryDate, ContractedServiceExpense, "
sql = sql & "TravelExpense, PersonnelExpense)"
sql = sql & " VALUES(''" & l_ENO & "'', " & Format(l_Date,
"\#mm\/dd\/yyyy\#") & ", " & l_contractedserviceexpense & ", "
&l_travelexpense & ", " &l_personnelexpense & ")"

解决方案

What does your format function look like? What kind of database are you
using?

Take a look at the functions here. http://www.aspfaq.com/show.asp?id=2313

Ray at work

"Jack" <Ja**@discussions.microsoft.com> wrote in message
news:62**********************************@microsof t.com...

Hi,
I cannot get the date format correctly in dynamic sql statement, after
trying various ways of handling it. I need some help with the date format in the following dynamic sql statement. Any help is appreciated in advance.
While running the asp page, I still get an error as
Error Type:
Microsoft VBScript runtime (0x800A000D)
Type mismatch: ''Format''

DYNAMIC SQL STATEMENT:
sql = " INSERT INTO tblExpense (ENO, EntryDate, ContractedServiceExpense, " sql = sql & "TravelExpense, PersonnelExpense)"
sql = sql & " VALUES(''" & l_ENO & "'', " & Format(l_Date,
"\#mm\/dd\/yyyy\#") & ", " & l_contractedserviceexpense & ", "
&l_travelexpense & ", " &l_personnelexpense & ")"



There is no Format in VBScript, sorry. And please stop using ambiguous
formats like mm/dd/yyyy. http://www.aspfaq.com/2023

--
Please post DDL, sample data and desired results.
See http://www.aspfaq.com/5006 for info.


"Jack" <Ja**@discussions.microsoft.com> wrote in message
news:62**********************************@microsof t.com...

Hi,
I cannot get the date format correctly in dynamic sql statement, after
trying various ways of handling it. I need some help with the date format in the following dynamic sql statement. Any help is appreciated in advance.
While running the asp page, I still get an error as
Error Type:
Microsoft VBScript runtime (0x800A000D)
Type mismatch: ''Format''

DYNAMIC SQL STATEMENT:
sql = " INSERT INTO tblExpense (ENO, EntryDate, ContractedServiceExpense, " sql = sql & "TravelExpense, PersonnelExpense)"
sql = sql & " VALUES(''" & l_ENO & "'', " & Format(l_Date,
"\#mm\/dd\/yyyy\#") & ", " & l_contractedserviceexpense & ", "
&l_travelexpense & ", " &l_personnelexpense & ")"



Ray,
I am using access in the backend. My problem is figure out how to manipulate
the date variable so that a response.write sql throws back date as
#10/01/2005#. The way I got it now, it does not allow the response.write
statement to work. At this point I do not care about any date format, rather
the sql statement to work properly by adding the delimiters to the date.
Thanks. Regards.

"Jack" wrote:

Hi,
I cannot get the date format correctly in dynamic sql statement, after
trying various ways of handling it. I need some help with the date format in
the following dynamic sql statement. Any help is appreciated in advance.
While running the asp page, I still get an error as
Error Type:
Microsoft VBScript runtime (0x800A000D)
Type mismatch: ''Format''

DYNAMIC SQL STATEMENT:
sql = " INSERT INTO tblExpense (ENO, EntryDate, ContractedServiceExpense, "
sql = sql & "TravelExpense, PersonnelExpense)"
sql = sql & " VALUES(''" & l_ENO & "'', " & Format(l_Date,
"\#mm\/dd\/yyyy\#") & ", " & l_contractedserviceexpense & ", "
&l_travelexpense & ", " &l_personnelexpense & ")"



这篇关于无法正确格式化日期字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆