473,320 Members | 1,600 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

To combine or leave as is...

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
Jul 19 '05 #1
11 1784
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...
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

Jul 19 '05 #2
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$**************@TK2MSFTNGP10.phx.gbl...
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...
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


Jul 19 '05 #3
That's a good idea. I can see myself using that for updates, inserts, and
deletes.

I've used functions like this before, but I don't think I've ever
genericized it. I should probably do that.

Function ReturnCategories()
Set o = server.CreateObject("adodb.connection")
o.open "connection"
Set rs = o.Execute("select catID,categories from theTable order by
Something")
If Not rs.EOF Then ReturnCategories = rs.GetRows()
rs.Close : Set rs = Nothing
o.Close : Set rs = Nothing
End Function

Then I can do like:

<select>
<%
aCats = ReturnCategories()
If Not IsEmpty(aCats) Then
For i = o To ubound(aCats, 2)
%>
<option value="<%=aCats(0, i)%>"><%=aCats(1, i)%></option>
<% Next %>
</select>
Ray at work
"Tom B" <sh*****@hotmail.com> wrote in message
news:uf****************@TK2MSFTNGP09.phx.gbl...
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.

Jul 19 '05 #4
Yes, that's even better.

"Ray at <%=sLocation%>" <myfirstname at lane34 dot com> wrote in message
news:On**************@tk2msftngp13.phx.gbl...
That's a good idea. I can see myself using that for updates, inserts, and
deletes.

I've used functions like this before, but I don't think I've ever
genericized it. I should probably do that.

Function ReturnCategories()
Set o = server.CreateObject("adodb.connection")
o.open "connection"
Set rs = o.Execute("select catID,categories from theTable order by
Something")
If Not rs.EOF Then ReturnCategories = rs.GetRows()
rs.Close : Set rs = Nothing
o.Close : Set rs = Nothing
End Function

Then I can do like:

<select>
<%
aCats = ReturnCategories()
If Not IsEmpty(aCats) Then
For i = o To ubound(aCats, 2)
%>
<option value="<%=aCats(0, i)%>"><%=aCats(1, i)%></option>
<% Next %>
</select>
Ray at work
"Tom B" <sh*****@hotmail.com> wrote in message
news:uf****************@TK2MSFTNGP09.phx.gbl...
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.


Jul 19 '05 #5
Why not selects?
It returns a disconnected recordset.

"Ray at <%=sLocation%>" <myfirstname at lane34 dot com> wrote in message
news:On**************@tk2msftngp13.phx.gbl...
That's a good idea. I can see myself using that for updates, inserts, and
deletes.

I've used functions like this before, but I don't think I've ever
genericized it. I should probably do that.

Function ReturnCategories()
Set o = server.CreateObject("adodb.connection")
o.open "connection"
Set rs = o.Execute("select catID,categories from theTable order by
Something")
If Not rs.EOF Then ReturnCategories = rs.GetRows()
rs.Close : Set rs = Nothing
o.Close : Set rs = Nothing
End Function

Then I can do like:

<select>
<%
aCats = ReturnCategories()
If Not IsEmpty(aCats) Then
For i = o To ubound(aCats, 2)
%>
<option value="<%=aCats(0, i)%>"><%=aCats(1, i)%></option>
<% Next %>
</select>
Ray at work
"Tom B" <sh*****@hotmail.com> wrote in message
news:uf****************@TK2MSFTNGP09.phx.gbl...
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.


Jul 19 '05 #6
What do you mean, "why not selects?" I guess I could do the disconnected
recordset instead, but I never thought to. I'm going to ~guess~ that an
array will use a few fewer bytes of memory, but I don't know that for a
fact.

Ray at work

"Tom B" <sh*****@hotmail.com> wrote in message
news:OG**************@TK2MSFTNGP11.phx.gbl...
Why not selects?
It returns a disconnected recordset.

"Ray at <%=sLocation%>" <myfirstname at lane34 dot com> wrote in message
news:On**************@tk2msftngp13.phx.gbl...
That's a good idea. I can see myself using that for updates, inserts, and deletes.

I've used functions like this before, but I don't think I've ever
genericized it. I should probably do that.

Function ReturnCategories()
Set o = server.CreateObject("adodb.connection")
o.open "connection"
Set rs = o.Execute("select catID,categories from theTable order by
Something")
If Not rs.EOF Then ReturnCategories = rs.GetRows()
rs.Close : Set rs = Nothing
o.Close : Set rs = Nothing
End Function

Then I can do like:

<select>
<%
aCats = ReturnCategories()
If Not IsEmpty(aCats) Then
For i = o To ubound(aCats, 2)
%>
<option value="<%=aCats(0, i)%>"><%=aCats(1, i)%></option>
<% Next %>
</select>
Ray at work

Jul 19 '05 #7
You said, you could see yourself "using that for updates, inserts, and
deletes"
why not SELECTs?

But you are right, the array is probably a better way.
"Ray at <%=sLocation%>" <myfirstname at lane34 dot com> wrote in message
news:eb**************@tk2msftngp13.phx.gbl...
What do you mean, "why not selects?" I guess I could do the disconnected
recordset instead, but I never thought to. I'm going to ~guess~ that an
array will use a few fewer bytes of memory, but I don't know that for a
fact.

Ray at work

"Tom B" <sh*****@hotmail.com> wrote in message
news:OG**************@TK2MSFTNGP11.phx.gbl...
Why not selects?
It returns a disconnected recordset.

"Ray at <%=sLocation%>" <myfirstname at lane34 dot com> wrote in message
news:On**************@tk2msftngp13.phx.gbl...
That's a good idea. I can see myself using that for updates, inserts, and deletes.

I've used functions like this before, but I don't think I've ever
genericized it. I should probably do that.

Function ReturnCategories()
Set o = server.CreateObject("adodb.connection")
o.open "connection"
Set rs = o.Execute("select catID,categories from theTable order by
Something")
If Not rs.EOF Then ReturnCategories = rs.GetRows()
rs.Close : Set rs = Nothing
o.Close : Set rs = Nothing
End Function

Then I can do like:

<select>
<%
aCats = ReturnCategories()
If Not IsEmpty(aCats) Then
For i = o To ubound(aCats, 2)
%>
<option value="<%=aCats(0, i)%>"><%=aCats(1, i)%></option>
<% Next %>
</select>
Ray at work


Jul 19 '05 #8
Oh, oh, I see. I meant using a generic SUB for executing updates, inserts,
and deletes. Like, things that I do not want a recordset returned from.
And then use a function to return arrays of data for SELECTS. Of course, I
can't even rememeber the last time I actually even coded an ASP page, so by
the time I get around to doing this, the Internet won't exist anymore.

Ray at work

"Tom B" <sh*****@hotmail.com> wrote in message
news:ux**************@TK2MSFTNGP12.phx.gbl...
You said, you could see yourself "using that for updates, inserts, and
deletes"
why not SELECTs?

But you are right, the array is probably a better way.

Jul 19 '05 #9
ACK....

Has my thread been hijacked? =)

--
Thanks from this ASP Newbie
Jul 19 '05 #10
Yes. Get your own thread! :P

Ray at work

"David P. Jessup" <davidATimntDASHtechDOTcom> wrote in message
news:u7**************@tk2msftngp13.phx.gbl...
ACK....

Has my thread been hijacked? =)

--
Thanks from this ASP Newbie

Jul 19 '05 #11
"Ray at <%=sLocation%>" <myfirstname at lane34 dot com> wrote in message
news:O$**************@TK2MSFTNGP10.phx.gbl...
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:

<snip>

I agree. By cramming everything into one file, the only thing you
accomplish is to make your code bloated and hard to work on. I would keep
them separate (and use includes for common code).

Regards,
Peter Foti

Jul 19 '05 #12

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Blah Blah | last post by:
here's my problem - i run a web site with a java servlet backend (apache/tomcat/linux/mysql), and i want to add some php content to my jsp pages. why would i want to do something like this? i...
3
by: Nick | last post by:
I am working a new application...well actually a series of applications for my company. They want internal users to be able to go to a site and everything regarding security is transparent,...
24
by: trint | last post by:
add them into one PrintDocument: PrintDocument pd1 = new PrintDocument(); PrintDocument pd2 = new PrintDocument(); PrintDocument pdCombined = new PrintDocument(); pdCombined = pd1 + pd2;...
1
by: William Stacey [MVP] | last post by:
I need a bullet proof way to combine a root and a relative path to form a FQ rooted path (similar to a VDir in IIS). Path.Combine alone will not do the job in all cases. I also need to be sure...
6
by: Luvin lunch | last post by:
Hi, I'm new to access and am very wary of dates as I have limited experience in their manipulation and I know if they're not done properly things can turn ugly quickly. I would like to use a...
3
by: Schroeder, AJ | last post by:
Hello group, I am a relative PHP newbie and I am trying to combine two arrays together, but I also need to keep the keys of one array intact. What I am doing is two SNMP walks against a Cisco...
2
by: nugz | last post by:
I want to combine 3 tables with like data then append it with a filter. Tables: NewStarts, Complaints, Memos Combine: Date, Address, Route, Pub, etc.... Then sort: previous 8 days, pub/freq...
2
by: drurjen | last post by:
Good morning. I am importing an XLS file into one of my tables. The fields are: Date Id Time IO 12/22/2006 2 12:48:45 PM 9 12/22/2006 16 5:40:55 AM 1 12/22/2006 16 12:03:59 PM 2 ...
3
by: Steven Bethard | last post by:
Within a larger pyparsing grammar, I have something that looks like:: wsj/00/wsj_0003.mrg When parsing this, I'd like to keep around both the full string, and the AAA_NNNN substring of it, so...
1
by: LSGKelly | last post by:
Hi all. I need to combine two fields that contain numbers that are in a currency format (Ex: $1,500 $3,500). When I combine them, I want them to look like this -- $1,500/$3,500. When I combine...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.