结合或离开...... [英] To combine or leave as is...

查看:83
本文介绍了结合或离开......的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在处理的当前应用程序包含3个单独的ASP页面。

我将数据发布到其他页面并使用request.form进行检索。

我的第一页有大约300行代码,第二页有大约550行

,最后一行有大约300行。


我觉得舒适地制作一个页面并制作3个单独的页面来接受

来电。我只是想知道单个页面上的性能将会有超过1000行代码。这三个页面中的每一页都会进行一些

排序的ADO调用。第一页和最后一页也是FSO电话。


有什么想法吗?


-

感谢此ASP新手

My current application I am working on consists of 3 separate ASP pages.
I''m posting data to each other page and using request.form to retrieve.

My first page has about 300 lines of code, the second has about 550 lines
and the last has about 300.

I feel comfortable making one page and making the 3 separate pages Subs to
call to. I''m just wondering about performance on a single page that will
have over 1000 lines of code. Each of the 3 pages do make ADO calls of some
sort. The first and last page make FSO calls too.

Any thoughts?

--
Thanks from this ASP Newbie

推荐答案

我个人更喜欢单独的页面,而不是试图将一些东西塞进一个页面,因为它们似乎有相似之处。如果他们使用

相同的代码,我会把它扔进一个包含,比如:


fso.inc:

< object runat =" server" progid =" scripting.filesystemobject"

id =" oFSO">< / object>


data.inc:

<%

Dim oADO

Sub OpenData()

设置oADO = Server.CreateObject(" ADODB.Connection")

oADO.Open连接字符串

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' >
即使我在我的连接字符串中定义数据库!

oADO.Execute" USE [SomeDB]"

End Sub < br $>

Sub CloseData()

oADO.Close

设置oADO = Nothing

End Sub

%>

所以,如果我知道我需要一个FSO或我的ADO连接,我只需要包含

相应的文件在那个页面。我尽量让每个页面都有代码

,这个页面是唯一的。


而且我没有必要使用.inc扩展名。我们不必在

那边切线。 :]那只是为了说明目的。


Ray在工作中


David P. Jessup < davidATimntDASHtechDOTcom>在消息中写道

news:u
I personally prefer having separate pages instead of trying to cram things
all into one page because they seem to have similarities. If they use the
same code at all, I''ll throw it in an include, like:

fso.inc:
<object runat="server" progid="scripting.filesystemobject"
id="oFSO"></object>

data.inc:
<%
Dim oADO
Sub OpenData()
Set oADO = Server.CreateObject("ADODB.Connection")
oADO.Open "the connection string"
''''''and for some damn reason on one of my servers, I suddenly have to do
this even though I''m defining the database in my connection string!
oADO.Execute "USE [SomeDB]"
End Sub

Sub CloseData()
oADO.Close
Set oADO = Nothing
End Sub
%>
So, if I know I''m going to need an FSO or my ADO connection, I just include
the appropriate file in that page. I try to make each page only have code
that is unique to that page, as much as possible.

And I don''t necessarly use the .inc extension. We don''t have to go off on
that tangent. :] That''s just for illustration purposes.

Ray at work


"David P. Jessup" <davidATimntDASHtechDOTcom> wrote in message
news:u


************** @ TK2MSFTNGP09.phx.gbl ...
**************@TK2MSFTNGP09.phx.gbl...
我正在处理的当前应用程序包含3个单独的ASP页面。
我将数据发布到其他页面并使用request.form进行检索。

我的第一页有大约300行代码,第二页有大约550行
,最后一页有大约300行。

我觉得很舒服制作一个页面并制作3个单独的页面打电话给。我只想知道单个页面上的性能是否会超过1000行代码。这三个页面中的每一个都会进行某种
的ADO调用。第一页和最后一页也是FSO电话。

有什么想法吗?

-
感谢这个ASP新手
My current application I am working on consists of 3 separate ASP pages.
I''m posting data to each other page and using request.form to retrieve.

My first page has about 300 lines of code, the second has about 550 lines
and the last has about 300.

I feel comfortable making one page and making the 3 separate pages Subs to
call to. I''m just wondering about performance on a single page that will
have over 1000 lines of code. Each of the 3 pages do make ADO calls of some sort. The first and last page make FSO calls too.

Any thoughts?

--
Thanks from this ASP Newbie



略微改变主题,但我的data.inc有一个名为

ExecuteSQL的函数,就像这样.....

函数Exec​​uteSQL(sSQL)

昏暗的CN

Dim RS

设置CN = CreateObject(" ADODB.Connection")

CN.Open通常的

设置RS = CreateObject(" ADODB.Recordset")

RS.CursorLocation = 3' 'adUseClient

RS.Open sSQL,CN

设置RS.ActiveConnection =无

设置ExecuteSQL = RS

设置RS =无

CN.Close

结束功能


现在,我不必打开和关闭连接,我只是在这个

一个函数中完成所有。


在我的页面上,我只是对我的函数执行sql语句。如果它是一个

更新,删除或插入,那么我只是忽略返回的任何内容。


" Ray at<%= sLocation%> " < myfirstname at lane34 dot com>在消息中写道

news:O
Slightly changing the subject, but my data.inc has a function called
ExecuteSQL like so.....

Function ExecuteSQL(sSQL)
Dim CN
Dim RS
Set CN=CreateObject("ADODB.Connection")
CN.Open "the usual"
Set RS=CreateObject("ADODB.Recordset")
RS.CursorLocation=3 ''adUseClient
RS.Open sSQL, CN
Set RS.ActiveConnection=nothing
Set ExecuteSQL=RS
Set RS=nothing
CN.Close
End Function

Now, I don''t have to open and close connections, I just do it all in this
one function.

On my pages I just execute sql statements against my function. If it''s an
Update, Delete or Insert then I just ignore anything returned.

"Ray at <%=sLocation%>" <myfirstname at lane34 dot com> wrote in message
news:O


这篇关于结合或离开......的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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