Oracle和asp .....仍然无法弄清楚这一点。 [英] Oracle and asp.....still cannot figure this out.

查看:61
本文介绍了Oracle和asp .....仍然无法弄清楚这一点。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有些人可以完成这行代码。对于我的生活

无论我尝试它什么都行不通。


我试图将当前日期时间插入到oracle中。现在我知道

如果我在oracle运行


选择to_char(sysdate,''dd / mm / yy hh24:mi:ss'')来自双$


结果将是15/06/06 14:49:35


现在我想将此语法插入到我的asp代码中我做了什么

创建了一个变量,并在我的插入语句中称为变量。

仍然不起作用


测试= to_char(sysdate,''dd / mm / yy hh24:mi:ss'')

ssqlCheckBox =" INSERT INTO

Survey_User_Answer(Survey_Id,Question_Id,Answer_Id, Date_Answer,User_ID)

VALUES(& SurveyID&",''"& objRS(" Question_Id")&"'',''"&

answerChoices(answerChoice)&"'',"& testing&",''user'')"


另外,我想插入我的插入声明,但不知道

Dim userrequested

userrequested = Re quest.ServerVariables(" LOGON_USER")

ssqlCheckBox =" INSERT INTO

Survey_User_Answer(Survey_Id,Question_Id,Answer_Id,Date_Answer,User_ID)
VALUES(" &安培; SurveyID& "," &安培; objRS(Question_Id)& '',''" &

answerChoices(answerChoice)& "'',to_char(''& sysdate&'',''dd / mm / yy

hh24:mi:ss''),''userrequested'')"

Could some please finish this line of code. For the life of me
whatever I try it does not work.

I am trying to insert the current date time into oracle. Now I know
that in oracle if I run

select to_char(sysdate, ''dd/mm/yy hh24:mi:ss'') from dual

result would be 15/06/06 14:49:35

Now I want to insert this syntax into my asp code so what I have done
is created a variable and in my insert statement called the variable.
Still does not work

testing = to_char(sysdate, ''dd/mm/yy hh24:mi:ss'')
ssqlCheckBox = "INSERT INTO
Survey_User_Answer(Survey_Id,Question_Id,Answer_Id ,Date_Answer,User_ID)
VALUES (" & SurveyID & ",''" & objRS("Question_Id") & "'' , ''" &
answerChoices(answerChoice) & "'' , "& testing & ", ''user'')"

Also, I would like to insert into my insert statement but have no idea
Dim userrequested
userrequested = Request.ServerVariables("LOGON_USER")

ssqlCheckBox = "INSERT INTO
Survey_User_Answer(Survey_Id,Question_Id,Answer_Id ,Date_Answer,User_ID)
VALUES (" & SurveyID & ",''" & objRS("Question_Id") & "'' , ''" &
answerChoices(answerChoice) & "'' , to_char(''&sysdate&'', ''dd/mm/yy
hh24:mi:ss''), ''userrequested'')"

推荐答案

2006年6月15日12:00:36 -0700, cl ******** @ hotmail.com 写道:
On 15 Jun 2006 12:00:36 -0700, cl********@hotmail.com wrote:
请一些人完成这行代码。对于我的生活
无论我尝试什么它都不起作用。

我试图将当前日期时间插入到oracle中。现在我知道在oracle中如果我运行

从双重选择to_char(sysdate,''dd / mm / yy hh24:mi:ss'')
结果将是15/06/06 14:49:35
现在我想将这个语法插入到我的asp代码中,所以我所做的
创建了一个变量并在我的插入中语句称为变量。
仍然不起作用

testing = to_char(sysdate,''dd / mm / yy hh24:mi:ss'')
ssqlCheckBox =" INSERT INTO
Survey_User_Answer(Survey_Id,Question_Id,Answer_I d,Date_Answer,User_ID)
VALUES(& SurveyID&",''"& objRS(" Question_Id")& "'',''"&
answerChoices(answerChoice)&"'',& testing&",''user'')"
Dim userrequested
userrequested = Request.ServerVariables(" LOGON_USER")

ssqlCheckBox ="插入
Survey_User_Answer(Survey_Id,Question_Id,Answer_I d,Date_Answer,User_ID)
VALUES(") &安培; SurveyID& "," &安培; objRS(Question_Id)& '',''" &
answerChoices(answerChoice)& "'',to_char(''& sysdate&'',''dd / mm / yy
hh24:mi:ss''),''userrequested'')"
Could some please finish this line of code. For the life of me
whatever I try it does not work.

I am trying to insert the current date time into oracle. Now I know
that in oracle if I run

select to_char(sysdate, ''dd/mm/yy hh24:mi:ss'') from dual

result would be 15/06/06 14:49:35

Now I want to insert this syntax into my asp code so what I have done
is created a variable and in my insert statement called the variable.
Still does not work

testing = to_char(sysdate, ''dd/mm/yy hh24:mi:ss'')
ssqlCheckBox = "INSERT INTO
Survey_User_Answer(Survey_Id,Question_Id,Answer_I d,Date_Answer,User_ID)
VALUES (" & SurveyID & ",''" & objRS("Question_Id") & "'' , ''" &
answerChoices(answerChoice) & "'' , "& testing & ", ''user'')"

Also, I would like to insert into my insert statement but have no idea
Dim userrequested
userrequested = Request.ServerVariables("LOGON_USER")

ssqlCheckBox = "INSERT INTO
Survey_User_Answer(Survey_Id,Question_Id,Answer_I d,Date_Answer,User_ID)
VALUES (" & SurveyID & ",''" & objRS("Question_Id") & "'' , ''" &
answerChoices(answerChoice) & "'' , to_char(''&sysdate&'', ''dd/mm/yy
hh24:mi:ss''), ''userrequested'')"



我发现调试连接字符串(特别是那些带单引号和双引号)的最好方法是使用

Response.Write,所以不要发送你的

对Oracle的声明,做一个


Response.Write(ssqlCheckBox)

假设:

Survey_ID = Meantest

objRS(" Question_ID")= 23

answerChoices(answerChoice)=是

user = JVG

then它需要以某种方式结束:


插入Survey_User_Answer(Survey_Id,Question_Id,Answer_Id,Date_Answer,User_ID)

VALUES(''吝啬'',''23'',''是'',To_char(sysdate,''dd / mm / yy hh24:mi:ss''),''JVG'')



The best way I have found to debug concatenated strings ( especially those with single and double quotes) is to use a
Response.Write, so instead of sending your
statement to Oracle, do a

Response.Write(ssqlCheckBox)
assume :
Survey_ID=Meantest
objRS("Question_ID") =23
answerChoices(answerChoice) = Yes
user =JVG
then it will need to end up ( somehow) like this:

Insert into Survey_User_Answer(Survey_Id,Question_Id,Answer_Id ,Date_Answer,User_ID)
VALUES (''Meantest'',''23'',''Yes'',To_char(sysdate,''dd/mm/yy hh24:mi:ss''),''JVG'' )



Hello Turkbear,


这是一个很好的建议,因为现在我已经插入语句

我需要处理到数据库中。但是,现在我感到很困惑,为什么它没有插入。一旦我尝试实际插入

这个到数据库我得到这个错误

错误类型:

Microsoft OLE DB Provider for ODBC Drivers(0x80004005 )

[Oracle] [ODBC] [Ora] ORA-01843:无效月份

/itsurvey/testSubmission.asp,第72行

任何想法?


这是插入字符串

INSERT INTO

Survey_User_Answer(Survey_Id,Question_Id,Answer_Id ,Date_Answer,User_Id)

VALUES(1,''1'','e'',''16/06/2006 11:09:20 AM'')


我在日期时间使用了函数Now()。

再次感谢

Turkbear写道:
Hello Turkbear,

This was an excellent suggestion as now I have the insert statement
that I need to be processed into the database. However, now I am
confused as to why it is not inserting. Once I try and actually insert
this into the database I get this error
Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
[Oracle][ODBC][Ora]ORA-01843: not a valid month
/itsurvey/testSubmission.asp, line 72

Any ideas?

Here is the insert string
INSERT INTO
Survey_User_Answer(Survey_Id,Question_Id,Answer_Id ,Date_Answer,User_Id)
VALUES (1,''1'', ''e'', ''16/06/2006 11:09:20 AM'')

I have used the function Now() for datetime.
Thanks again
Turkbear wrote:
6月15日2006年12月12日 - 07日, cl********@hotmail.com 写道:
On 15 Jun 2006 12:00:36 -0700, cl********@hotmail.com wrote:
有些人可以完成这行代码。对于我的生活
无论我尝试什么它都不起作用。

我试图将当前日期时间插入到oracle中。现在我知道在oracle中如果我运行

从双重选择to_char(sysdate,''dd / mm / yy hh24:mi:ss'')
结果将是15/06/06 14:49:35
现在我想将这个语法插入到我的asp代码中,所以我所做的
创建了一个变量并在我的插入中语句称为变量。
仍然不起作用

testing = to_char(sysdate,''dd / mm / yy hh24:mi:ss'')
ssqlCheckBox =" INSERT INTO
Survey_User_Answer(Survey_Id,Question_Id,Answer_I d,Date_Answer,User_ID)
VALUES(& SurveyID&",''"& objRS(" Question_Id")& "'',''"&
answerChoices(answerChoice)&"'',& testing&",''user'')"
Dim userrequested
userrequested = Request.ServerVariables(" LOGON_USER")

ssqlCheckBox ="插入
Survey_User_Answer(Survey_Id,Question_Id,Answer_I d,Date_Answer,User_ID)
VALUES(") &安培; SurveyID& "," &安培; objRS(Question_Id)& '',''" &
answerChoices(answerChoice)& "'',to_char(''& sysdate&'',''dd / mm / yy
hh24:mi:ss''),''userrequested'')"
Could some please finish this line of code. For the life of me
whatever I try it does not work.

I am trying to insert the current date time into oracle. Now I know
that in oracle if I run

select to_char(sysdate, ''dd/mm/yy hh24:mi:ss'') from dual

result would be 15/06/06 14:49:35

Now I want to insert this syntax into my asp code so what I have done
is created a variable and in my insert statement called the variable.
Still does not work

testing = to_char(sysdate, ''dd/mm/yy hh24:mi:ss'')
ssqlCheckBox = "INSERT INTO
Survey_User_Answer(Survey_Id,Question_Id,Answer_I d,Date_Answer,User_ID)
VALUES (" & SurveyID & ",''" & objRS("Question_Id") & "'' , ''" &
answerChoices(answerChoice) & "'' , "& testing & ", ''user'')"

Also, I would like to insert into my insert statement but have no idea
Dim userrequested
userrequested = Request.ServerVariables("LOGON_USER")

ssqlCheckBox = "INSERT INTO
Survey_User_Answer(Survey_Id,Question_Id,Answer_I d,Date_Answer,User_ID)
VALUES (" & SurveyID & ",''" & objRS("Question_Id") & "'' , ''" &
answerChoices(answerChoice) & "'' , to_char(''&sysdate&'', ''dd/mm/yy
hh24:mi:ss''), ''userrequested'')"



我发现调试连接字符串(特别是那些带有单引号和双引号的字符串)的最好方法是使用
Response.Write,所以不要将
语句发送给Oracle,做一个

Response.Write(ssqlCheckBox)
假设:
Survey_ID = Meantest
objRS(" Question_ID")= 23
answerChoices(answerChoice) =是
用户= JVG
然后它将需要以某种方式结束这样:

插入Survey_User_Answer(Survey_Id,Question_Id,Answer_Id,Date_Answer,User_ID)
VALUES(''Meantest'',''23'',''是'',To_char(sysdate,''dd / mm / yy hh24:mi:ss''),''JVG'')


The best way I have found to debug concatenated strings ( especially those with single and double quotes) is to use a
Response.Write, so instead of sending your
statement to Oracle, do a

Response.Write(ssqlCheckBox)
assume :
Survey_ID=Meantest
objRS("Question_ID") =23
answerChoices(answerChoice) = Yes
user =JVG
then it will need to end up ( somehow) like this:

Insert into Survey_User_Answer(Survey_Id,Question_Id,Answer_Id ,Date_Answer,User_ID)
VALUES (''Meantest'',''23'',''Yes'',To_char(sysdate,''dd/mm/yy hh24:mi:ss''),''JVG'' )






2006年6月16日08:10:27 -0700, cl ******** @ hotmail.com 写道:
On 16 Jun 2006 08:10:27 -0700, cl********@hotmail.com wrote:
Hello Turkbear,

这是一个很好的建议,因为现在我有插入声明
我需要将其处理到数据库中。但是,现在我很困惑为什么它不插入。一旦我尝试将其实际插入数据库,我就会收到此错误
错误类型:
用于ODBC驱动程序的Microsoft OLE DB提供程序(0x80004005)
[Oracle] [ODBC] [ Ora] ORA-01843:不是有效的月份
/itsurvey/testSubmission.asp,第72行

任何想法?

这里是插入字符串
INSERT INTO
Survey_User_Answer(Survey_Id,Question_Id,Answer_I d,Date_Answer,User_Id)
VALUES(1,''1',''e'',''16 / 06/2006 11:09 :上午20点'')

我在日期时间使用了函数Now()。

再次感谢

Turkbear写道:
Hello Turkbear,

This was an excellent suggestion as now I have the insert statement
that I need to be processed into the database. However, now I am
confused as to why it is not inserting. Once I try and actually insert
this into the database I get this error
Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
[Oracle][ODBC][Ora]ORA-01843: not a valid month
/itsurvey/testSubmission.asp, line 72

Any ideas?

Here is the insert string
INSERT INTO
Survey_User_Answer(Survey_Id,Question_Id,Answer_I d,Date_Answer,User_Id)
VALUES (1,''1'', ''e'', ''16/06/2006 11:09:20 AM'')

I have used the function Now() for datetime.
Thanks again
Turkbear wrote:
2006年6月15日12:00:36 -0700, cl ******** @ hotmail。 com 写道:
On 15 Jun 2006 12:00:36 -0700, cl********@hotmail.com wrote:
>有些人可以完成这行代码。对于我的生活
>无论我尝试它什么都行不通。
>
>我试图将当前日期时间插入到oracle中。现在我知道
>在oracle,如果我运行
>
>从双<选择to_char(sysdate,''dd / mm / yy hh24:mi:ss'') br />>
>结果将是15/06/06 14:49:35
>
>现在我想将此语法插入到我的asp代码中所以我已完成
>创建了一个变量,并在我的插入语句中调用了变量。
>仍然不起作用
>
> testing = to_char(sysdate,' 'dd / mm / yy hh24:mi:ss'')
> ssqlCheckBox =" INSERT INTO
> Survey_User_Answer(Survey_Id,Question_Id,Answer_I d,Date_Answer,User_ID)
> ; VALUES(& SurveyID&",''"& objRS(" Question_Id")&"'',''"&
> answerChoices(answerChoice)& ;"'',"& testing&",''user'')"
>
>另外,我想插入我的insert语句但是没有想法
> Dim userrequested
> userrequeste d = Request.ServerVariables(" LOGON_USER")
>
> ssqlCheckBox =" INSERT INTO
> Survey_User_Answer(Survey_Id,Question_Id,Answer_I d,Date_Answer,User_ID)
> VALUES(" VALUES) &安培; SurveyID& "," &安培; objRS(Question_Id)& '',''" &
> answerChoices(answerChoice)& "'',to_char(''& sysdate&'',''dd / mm / yy
> hh24:mi:ss''),''userrequested'')"
>Could some please finish this line of code. For the life of me
>whatever I try it does not work.
>
>I am trying to insert the current date time into oracle. Now I know
>that in oracle if I run
>
>select to_char(sysdate, ''dd/mm/yy hh24:mi:ss'') from dual
>
>result would be 15/06/06 14:49:35
>
>Now I want to insert this syntax into my asp code so what I have done
>is created a variable and in my insert statement called the variable.
>Still does not work
>
>testing = to_char(sysdate, ''dd/mm/yy hh24:mi:ss'')
>ssqlCheckBox = "INSERT INTO
>Survey_User_Answer(Survey_Id,Question_Id,Answer_I d,Date_Answer,User_ID)
>VALUES (" & SurveyID & ",''" & objRS("Question_Id") & "'' , ''" &
>answerChoices(answerChoice) & "'' , "& testing & ", ''user'')"
>
>Also, I would like to insert into my insert statement but have no idea
>Dim userrequested
>userrequested = Request.ServerVariables("LOGON_USER")
>
>ssqlCheckBox = "INSERT INTO
>Survey_User_Answer(Survey_Id,Question_Id,Answer_I d,Date_Answer,User_ID)
>VALUES (" & SurveyID & ",''" & objRS("Question_Id") & "'' , ''" &
>answerChoices(answerChoice) & "'' , to_char(''&sysdate&'', ''dd/mm/yy
>hh24:mi:ss''), ''userrequested'')"



我发现调试连接字符串(特别是那些带有单引号和双引号)的最好方法是使用
Response.Write,所以不要将
语句发送到Oracle,做一个Response.Write(ssqlCheckBox)
假设:
Survey_ID = Meantest
objRS(" Question_ID")= 23
answerChoices( answerChoice)=是
用户= JVG
那么它需要以某种方式结束这样:

插入Survey_User_Answer(Survey_Id,Question_Id,Answer_Id,Date_Answer,User_ID)
VALUES(''Meantest'',''23'',''Yes'',To_char(sysdate,''dd / mm / yy hh24:mi:ss''),''JVG'')


The best way I have found to debug concatenated strings ( especially those with single and double quotes) is to use a
Response.Write, so instead of sending your
statement to Oracle, do a

Response.Write(ssqlCheckBox)
assume :
Survey_ID=Meantest
objRS("Question_ID") =23
answerChoices(answerChoice) = Yes
user =JVG
then it will need to end up ( somehow) like this:

Insert into Survey_User_Answer(Survey_Id,Question_Id,Answer_Id ,Date_Answer,User_ID)
VALUES (''Meantest'',''23'',''Yes'',To_char(sysdate,''dd/mm/yy hh24:mi:ss''),''JVG'' )




嗨..

请不要顶级..这使得难以跟踪线程..

你必须使用to_date函数h正确的掩码,而不是数据库NOW()的原始结果 -

喜欢:to_date(Now(),''dd / mm / yyyy hh24:mi:ss AM'')。


这样做会导致一个类似的插入语句:


INSERT INTO

Survey_User_Answer(Survey_Id, Question_Id,Answer_Id,Date_Answer,User_Id)

VALUES(1,''1',''e'',to_date(''2006年6月16日11:09:20'', ''dd / mm / yyyy hh24:mi:ss am''))




Hi..
Please do not top-post..it makes it difficult to follow the thread..
You MUST use the to_date Function with the correct mask , not the raw result on NOW() for the database -
like: to_date(Now(),''dd/mm/yyyy hh24:mi:ss AM'').

Doing this wil result it a insert statement something like this:

INSERT INTO
Survey_User_Answer(Survey_Id,Question_Id,Answer_Id ,Date_Answer,User_Id)
VALUES (1,''1'', ''e'', to_date(''16/06/2006 11:09:20 AM'',''dd/mm/yyyy hh24:mi:ss AM'') )



这篇关于Oracle和asp .....仍然无法弄清楚这一点。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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