JavaScript可以使用ASP创建的ADO记录集吗? [英] Can ADO Recordsets Created By ASP Be Used By JavaScript?

查看:106
本文介绍了JavaScript可以使用ASP创建的ADO记录集吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,


我的ASP代码在服务器上创建了一个ADO记录集对象。


稍后在同一页面上,我有一个我使用的javascript代码段

根据另一个

下拉框中的选项动态填充下拉框。这个javascript(或服务器端的等价物)可以访问

记录集对象吗?


--Eric

解决方案

Eric Robinson写道:

您好,
我的ASP代码在服务器上创建了一个ADO记录集对象。

稍后在同一页面上,我有一个javascript代码段,用于根据另一个
下拉框中的选项动态填充下拉框。这个javascript(或服务器端的等价物)可以访问记录集对象吗?



只有将它传递给客户端代码。我倾向于避免尝试在客户端上使用

ADO,而更喜欢使用XML,但这是一种方法(这个

示例使用vbscript客户端脚本,但它可以很容易地被重写为使用jscript代替


http://www.davidpenton.com/testsite/...ver2client.asp


Bob Barrows

-

Microsoft MVP - ASP / ASP.NET

请回复新闻组。我的From

标题中列出的电子邮件帐户是我的垃圾邮件陷阱,因此我不经常检查它。通过发布到新闻组,您将获得更快的回复。


您好,


我的问题很混乱,因为我自己有点困惑。我不是在客户端使用ADO的
。 ADO连接和记录集通过ASP在服务器上实例化
。我的问题是,服务器端的Javascript可以使用通过ASP代码在同一页面上创建的
a服务器端对象吗?

或服务器端Javascript必须实例化自己独立的

连接和记录集对象?

--Eric


" Bob Barrows [MVP] QUOT; <再****** @ NOyahoo.SPAMcom>在消息中写道

news:OU ************** @ TK2MSFTNGP14.phx.gbl ...

Eric Robinson写道:< blockquote class =post_quotes>你好,

我的ASP代码在服务器上创建了一个ADO记录集对象。

稍​​后在同一页面上,我有一个javascript代码片段我根据另一个
下拉框中的选项动态填充下拉框。这个javascript(或服务器端的等价物)可以访问记录集对象吗?


只有将它传递给客户端代码。我倾向于避免在客户端上尝试使用ADO,而更喜欢使用XML,但这是一种方法来实现它
(这个例子使用了vbscript客户端脚本但可以很容易地重写以使用jscript代替):

http://www.davidpenton.com/testsite/...ver2client.asp

Bob Barrows
-
Microsoft MVP - ASP / ASP.NET
请回复新闻组。我的From
标题中列出的电子邮件帐户是我的垃圾邮件陷阱,因此我不经常检查它。通过发布到新闻组,您将得到更快的回复。



" Eric Robinson" < eric @ pmcipa .. {com}>写道:

我的问题很混乱,因为我自己有点困惑。我不是在客户端上使用ADO。 ADO连接和记录集通过ASP在服务器上实例化。我的问题是,服务器端Javascript是否可以使用由ASP代码在同一页面上创建的服务器端对象?
服务器端Javascript是否必须实例化其自己的单独
连接和记录集对象?




当客户端Javascript运行时,所有ASP代码 - 无论是

VBScript,Javascript,或另一种语言 - 已经完成,不再是

存在。既然如此,客户端Javascript就无法使用任何ASP对象。


-

Tim Slattery

MS MVP(DTS)
Sl ******* *@bls.gov


Hello,

My ASP code creates an ADO recordset object on the server.

Later on the same page, I have a javascript code snippet that I use to
dynamically populate a drop-down box based on choices made in another
drop-down box. Can this javascript (or a server-side equivalent) access the
recordset object?

--Eric

解决方案

Eric Robinson wrote:

Hello,

My ASP code creates an ADO recordset object on the server.

Later on the same page, I have a javascript code snippet that I use to
dynamically populate a drop-down box based on choices made in another
drop-down box. Can this javascript (or a server-side equivalent)
access the recordset object?


Only if it is passed to the client-side code. I tend to avoid trying to use
ADO on the client, preferring to use XML, but here''s one way to do it (this
example uses vbscript in the client-side script but it can easily be
rewritten to use jscript instead):

http://www.davidpenton.com/testsite/...ver2client.asp

Bob Barrows
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don''t check it very often. You will get a
quicker response by posting to the newsgroup.


Hi,

My question was confusing because I myself am a little confused. I am not
using ADO on the client. The ADO connection and recordset are instantiated
on the server through ASP. My question is, can a server-side Javascript use
a server-side object that was created earlier on the same page by ASP code?
Or does the server-side Javascript have to instantiate its own separate
connection and recordset objects?

--Eric

"Bob Barrows [MVP]" <re******@NOyahoo.SPAMcom> wrote in message
news:OU**************@TK2MSFTNGP14.phx.gbl...

Eric Robinson wrote:

Hello,

My ASP code creates an ADO recordset object on the server.

Later on the same page, I have a javascript code snippet that I use to
dynamically populate a drop-down box based on choices made in another
drop-down box. Can this javascript (or a server-side equivalent)
access the recordset object?


Only if it is passed to the client-side code. I tend to avoid trying to
use
ADO on the client, preferring to use XML, but here''s one way to do it
(this
example uses vbscript in the client-side script but it can easily be
rewritten to use jscript instead):

http://www.davidpenton.com/testsite/...ver2client.asp

Bob Barrows
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don''t check it very often. You will get a
quicker response by posting to the newsgroup.



"Eric Robinson" <eric @ pmcipa..{com}> wrote:

My question was confusing because I myself am a little confused. I am not
using ADO on the client. The ADO connection and recordset are instantiated
on the server through ASP. My question is, can a server-side Javascript use
a server-side object that was created earlier on the same page by ASP code?
Or does the server-side Javascript have to instantiate its own separate
connection and recordset objects?



By the time client-side Javascript runs, all ASP code - whether
VBScript, Javascript, or another language - has finished and no longer
exists. That being the case, there''s no way client-side Javascript can
use any ASP object.

--
Tim Slattery
MS MVP(DTS)
Sl********@bls.gov


这篇关于JavaScript可以使用ASP创建的ADO记录集吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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