---
title: "If, Querystring, Include Prestanda"
type: "forum-thread"
url: "https://www.webforum.nu/amne/asp/8158-if-querystring-include-prestanda"
topic: "ASP"
topic_url: "https://www.webforum.nu/amne/asp"
author: "erka"
published: "2001-02-15T10:19:00.000Z"
updated: "2001-02-15T12:42:00.000Z"
replies: 6
views: 275
page: 1
pages: 1
language: "sv-SE"
site: "webForum — webforum.nu"
rights: "Upphovsrätten till varje inlägg tillhör dess författare."
attribution: "Citera som: webForum, https://www.webforum.nu/amne/asp/8158-if-querystring-include-prestanda"
---

# If, Querystring, Include Prestanda

## #1 — erka, 2001-02-15T10:19Z

Jag har en sida som först ser ut så här

```
% If Request.Querystring("action") = "0" Then %>
<!--#include file="code/dist0.code"-->
<% ElseIf Request.Querystring("action") = "1" Then %>
<!--#include file="code/dist1.code"-->
<% ElseIf Request.Querystring("action") = "2" Then %>
<!--#include file="code/dist2.code"-->
<% End If %>
```

sen ser .code filerna ut så tex så här

```

<%

Response.Write"<table width='600' border='0'><tr><td width='25'></td><td width='585' class='txtmain'><table cellpadding='0' cellspacing='0' border='0' width='500'><tr class='txtmain'><td>"

Set Connect = Server.CreateObject("ADODB.Connection")
Connect.Open "driver={Microsoft Access Driver (*.mdb)};dbq=c:\inetpub\wwwroot\db\customer00.mdb" 

'SÄTTER VÄRDET FRÅN FORMULÄRKNAPPARNA TILL EN COOKIE SAMMLING
Response.Cookies("koll")("a1") = request.form("a1")
Response.Cookies("koll")("a2") = request.form("a2")
Response.Cookies("koll")("a3") = request.form("a3")
Response.Cookies("koll")("a4") = request.form("a4")
Response.Cookies("checkflagg") = "False"

if request.cookies("koll")("a1") > "" Then
IntAutomation = "1"
Response.Cookies("checkflagg") = "True"
a1 = true
End If

If request.cookies("koll")("a2") > "" Then
IntConveying = "2"
Response.Cookies("checkflagg") = "True"
a2 = true
End If

If request.cookies("koll")("a3") > "" Then
IntGap = "3"
Response.Cookies("checkflagg") = "True"
a3 = true
End If

If request.cookies("koll")("a4") > "" Then
IntLabVac = "4"
Response.Cookies("checkflagg") = "True"
a4 = true
End If

'KOLLA OM MAN VALDE NÅGOT ÖVER HUVUD TAGET
If Request.Cookies("checkflagg") = "False" Then
Response.Write"Du valde inte någon produkt grupp"
Connect.Close

End If

StrSQL = "Select CountryRep.CountryRepENG, d1.CustomerType, D1.Automation, D1.Transport, d1.Labvacs, d1.GAP FROM D1 INNER JOIN CountryRep On D1.CustomerID = CountryRep.CustomerID GROUP BY CountryRep.CountryRepENG, d1.Companyname, d1.Customertype, d1.automation, d1.transport, d1.Labvacs, d1.gap HAVING "
StrSQLAutomation = "d1.Automation='"
StrSQLConveying = "d1.Transport='"
StrSQLGap = "d1.Gap='"
StrSQLLabVacs ="d1.Labvacs='"
StrSQLClose = "' Order By CountryREP.CountryRepENG"
StrSQLAnd = "' OR "

If a1 = true Then
StrSQL = StrSQL & StrSQLAutomation & IntAutomation
If a2= true Or a3 = true Or a4 = true Then
StrSQL = StrSQL & StrSQLAnd
End If
End If

If a2 = true Then
StrSQL = StrSQL & StrSQLConveying & IntConveying
If a3 = true Or a4 = true Then
StrSQL = StrSQL & StrSQLAnd
End If
End If

If a3 = true Then
StrSQL = StrSQL & StrSQLGap & IntGap
If a4 = true Then
StrSQL = StrSQL & StrSQLAnd
End If
End If

If a4 = true Then
StrSQL = StrSQL & StrSQLLabVacs & IntLabVac
End If
StrSQL = StrSQL & StrSQLClose
Prevcountry = "nothing"
Set RS = Connect.Execute(StrSQL)

Response.Write"<span class='P_header1'>Distributors</span><br>"

Response.Write"Selected Product group(s):<br>"
If Request.Cookies("koll" & a1).Haskeys = FALSE Then 
Response.Write"-Pumps, Suction Cups, Logics<br>"
End If

If Request.Cookies("koll" & a2).Haskeys = FALSE Then 
Response.Write"-Vacuum Conveying<br>"
End If

If Request.Cookies("koll" & a3).Haskeys = FALSE Then 
Response.Write"-Graphic Air Pumps<br>"
End If

If Request.Cookies("koll" & a4).Haskeys = FALSE Then 
Response.Write"-Lab Vacs<br>"
End If

Response.Write"<br><br>The product group(s) you have selected have distributors in the following countries:<br>"

response.write"<table width='500' border='0' cellspacing='0' cellpadding='0'><tr><td width='128' valign='middle'><FORM method='post' action='distributors.asp?action=2'><SELECT Name='StrCountry' class='txtbox'>"

While NOT RS.EOF
If prevCountry <> rs("CountryRepENG") Then
Response.Write"<option>"
Response.Write rs("CountryRepENG")
Response.Write"</option>"'
PrevCountry = RS("CountryRepENG")
RS.MoveNext
Else
Rs.MoveNext
End If
Wend
RS.Close
Connect.Close

Response.Write"</select></td><td width='372' valign='middle'><br><input src='images/cmd_go.gif' name='skicka' border='0' type='image'></form></td></tr></table></tr></table></td></tr></table>"
%>
```

Jag läste någon stanns att han går igenom alla include filer redan när man gör if / querystring sattsen. Om det är så borde ju ett sådant här sett att gå tillväga ta mer kräm än om man delat upp den på 3 filer ? har jag rätt eller helt fel ?

tacksam

Permalänk: https://www.webforum.nu/p/8158

## #2 — Vide, 2001-02-15T12:09Z

Du har rätt... plus en detalj: Includefilernas innehåll hämtas innan du har hunnit till tolkningen av koden, dvs din if-sats...

Med ASP 3.0 kan du istället för include köra Server.execute, vilket du på dynamiskt sätt kan strukturera upp som ett mer servervänligt upplägg... oj, ordbajs... ;)

\[R\]Glömde viktig info!\[/R\]

Permalänk: https://www.webforum.nu/p/259250

## #3 — erka, 2001-02-15T12:11Z

Så jag skulle kunna skriva ut mina .code filer som bara inehåller asp, massa response writar (tabeller) å annan kod då med server.execute...

Prestanda mässigt ? tar det mycket kraft ?

Permalänk: https://www.webforum.nu/p/259251

## #4 — Vide, 2001-02-15T12:24Z

Nja, det skulle vara mindra krävande än din nuvarande kod...

Om skillnaden mellan dina filer tillåter det så skulle jag nog bygga en funktion eller sub av det hela, och skicka med det lilla som skall ändras...

Permalänk: https://www.webforum.nu/p/259252

## #5 — erka, 2001-02-15T12:33Z

Det är rätt stor skillnad på dem så jag vet inte...Är server.execute grymt prestanda slukande eller ?

Permalänk: https://www.webforum.nu/p/259253

## #6 — Vide, 2001-02-15T12:38Z

Nej! :)

Permalänk: https://www.webforum.nu/p/259254

## #7 — erka, 2001-02-15T12:42Z

tack så mycket du är en riktig \*\*bäjby\*\*

Permalänk: https://www.webforum.nu/p/259255

---

Tråden på webben: https://www.webforum.nu/amne/asp/8158-if-querystring-include-prestanda
