Når du med din sql statement beder den om at f.eks. kigge i en tabel som ikke findes får du en fejl som egenligt siger som din, eller hvis du leder efter et felt som ikke er der, eller du indtaster data fra en variabel (kan være en form) som er tom eller hvor du har en '' fejl eller en "" fejl......
Så din connection og sql statement er i hvert fald nødvendig for at kunne hjælpe.....
if session("login") = "" Then Response.redirect("login.asp") end if
Dim Error_Array() Dim j Dim Selected Dim ComboBox_Str Dim FirstRow Dim Arrival,Arrival1,navn,Antal,Antal1,PrisVoksenSalg,PrisVoksenSalg1,PrisBarnSalg,PrisBarnSalg1,PrisInfantSalg,PrisInfantSalg1,terminal,Terminal1
Function OpretBooking()
Response.Write("Opret Booking...")
End Function
Sub ShowReturnValue(aFe) Response.Write(Request.Form(aFe)) End Sub
rsObj.Close Set rsObj = Nothing Set cmdObj = Nothing DataConn.Close Set DataConn = Nothing End Sub
Sub DisableCombobox(aFe) ComboBox_Str = "<select disabled='True' name='" & aFe & "' onchange='document.forms[0].submit();' " &_ "id='selectbox'><option selected='True'>Vælg</option></select>" Response.Write(ComboBox_Str) End Sub
Sub ShowFra(aFe) if aFe = "Afrejse" then FirstRow = True else FirstRow = False End if GetComboData aFe,"SELECT Distinct x_afrejse FROM flight where x_antal > 0 ORDER BY x_afrejse ASC" End Sub
Sub ShowTil(aFe) if Selected then if FirstRow then Afrejse = Request.Form("Afrejse") else Afrejse = Request.Form("Afrejse1") End if Sql_Str = "SELECT Distinct x_ankomst FROM flight WHERE x_antal > 0 AND (x_afrejse='" &_ Afrejse & "') ORDER BY x_ankomst ASC" GetComboData aFe,Sql_Str else DisableCombobox(aFe) End if End Sub
Sub ShowFlight(aFe) if Selected then if FirstRow then Ankomst = Request.Form("Ankomst") Afrejse = Request.Form("Afrejse") else Ankomst = Request.Form("Ankomst1") Afrejse = Request.Form("Afrejse1") End if
Sql_Str = "SELECT Distinct x_flightnr,x_Destairlines FROM flight WHERE x_antal > 0 AND (x_afrejse='" &_ Afrejse & "') AND (x_ankomst='" & Ankomst &_ "') ORDER BY x_Destairlines ASC" GetComboData aFe,Sql_Str else DisableCombobox(aFe) End if End Sub
Sub ShowDato(aFe) if Selected then if FirstRow then Ankomst = Request.Form("Ankomst") Afrejse = Request.Form("Afrejse") Tmp_Array = Split(Request.Form("flightnr"),":") Flightnr = Trim(Tmp_Array(0)) else Ankomst = Request.Form("Ankomst1") Afrejse = Request.Form("Afrejse1") Tmp_Array = Split(Request.Form("flightnr1"),":") Flightnr = Trim(Tmp_Array(0)) End if Sql_Str = "SELECT Distinct x_afrejsedato FROM flight WHERE x_antal > 0 AND (x_afrejse='" &_ Afrejse & "') AND (x_ankomst='" & Ankomst &_ "') AND (x_flightnr='" & Flightnr & "') ORDER BY x_afrejsedato ASC" GetComboData aFe,Sql_Str else DisableCombobox(aFe) End if End Sub
Sub ShowDepart(aFe) if Selected then if FirstRow then Ankomst = Request.Form("Ankomst") Afrejse = Request.Form("Afrejse") Tmp_Array = Split(Request.Form("flightnr"),":") Flightnr = Trim(Tmp_Array(0)) Afrejsedato = Request.Form("afrejsedato") else Ankomst = Request.Form("Ankomst1") Afrejse = Request.Form("Afrejse1") Tmp_Array = Split(Request.Form("flightnr1"),":") Flightnr = Trim(Tmp_Array(0)) Afrejsedato = Request.Form("hjemrejsedato") End if Sql_Str = "SELECT x_depart FROM flight WHERE x_antal > 0 AND (x_afrejse='" &_ Afrejse & "') AND (x_ankomst='" & Ankomst &_ "') AND (x_flightnr='" & Flightnr & "') " &_ "AND (x_afrejsedato='" & Afrejsedato & "') ORDER BY x_depart ASC" GetComboData aFe,Sql_Str else DisableCombobox(aFe) End if End Sub
Sub ShowArrival(aFe) if Selected then if FirstRow then Afrejse = Request.Form("Afrejse") Tmp_Array = Split(Request.Form("flightnr"),":") Flightnr = Trim(Tmp_Array(0)) Afrejsedato = Request.Form("afrejsedato") Depart = Request.Form("depart") else Afrejse = Request.Form("Afrejse1") Tmp_Array = Split(Request.Form("flightnr1"),":") Flightnr = Trim(Tmp_Array(0)) Afrejsedato = Request.Form("hjemrejsedato") Depart = Request.Form("depart1") End if
Sql_Str = "SELECT x_arrival,x_antal,x_PrisVoksenSalg,x_PrisBarnSalg," &_ "x_PrisInfantSalg,x_terminal FROM flight WHERE x_antal > 0 AND (x_afrejse='" &_ Afrejse & "') AND (x_flightnr='" & Flightnr & "') " &_ "AND (x_afrejsedato='" & Afrejsedato & "') AND (" &_ "x_depart='" & Depart & "')"
if FirstRow then Arrival = rsObj.Fields(0).Value Antal = rsObj.Fields(1).Value PrisVoksenSalg = rsObj.Fields(2).Value PrisBarnSalg = rsObj.Fields(3).Value PrisInfantSalg = rsObj.Fields(4).Value Terminal = rsobj.Fields(5).Value Response.Write Arrival else Arrival1 = rsObj.Fields(0).Value Antal1 = rsObj.Fields(1).Value PrisVoksenSalg1 = rsObj.Fields(2).Value PrisBarnSalg1 = rsObj.Fields(3).Value PrisInfantSalg1 = rsObj.Fields(4).Value Terminal1 = rsobj.Fields(5).Value Response.Write Arrival1 End if
rsObj.Close Set rsObj = Nothing Set cmdObj = Nothing DataConn.Close Set DataConn = Nothing End if End Sub
Sub ShowAntal if FirstRow then Response.Write(Antal) else Response.Write(Antal1) End if End Sub
Sub ShowTerminal if FirstRow then Response.Write("<span id='anter'>" & terminal & "</span>") else Response.Write("<span id='anter'>" & terminal1 & "</span>") End if End Sub
Sub ShowFlyID if Selected then if FirstRow then Afrejse = Request.Form("Afrejse") Tmp_Array = Split(Request.Form("flightnr"),":") Flightnr = Trim(Tmp_Array(0)) Afrejsedato = Request.Form("afrejsedato") Depart = Request.Form("depart") else Afrejse = Request.Form("Afrejse1") Tmp_Array = Split(Request.Form("flightnr1"),":") Flightnr = Trim(Tmp_Array(0)) Afrejsedato = Request.Form("hjemrejsedato") Depart = Request.Form("depart1") End if
Sql_Str = "SELECT ID FROM flight WHERE x_antal > 0 AND (x_afrejse='" &_ Afrejse & "') AND (x_flightnr='" & Flightnr & "') " &_ "AND (x_afrejsedato='" & Afrejsedato & "') AND (" &_ "x_depart='" & Depart & "')"
if FirstRow then Response.Write("<input type='hidden' name='FlyID' value='" & rsObj.Fields(0).Value & "'>") else Response.Write("<input type='hidden' name='FlyID1' value='" & rsObj.Fields(0).Value & "'>") End if
rsObj.Close Set rsObj = Nothing Set cmdObj = Nothing DataConn.Close Set DataConn = Nothing End if End Sub
Sub ShowError(aFE) ReturnValue = "" For Each Ele In Error_Array if Ele = aFE then ReturnValue = "<span style='font-weight: 700; color: red; font-size: 12px;'>*</span>" Exit For end if Next 'Response.Write(Ele) Response.Write(ReturnValue) end Sub
Function BookingCheck if Request.Form("Action") = "" then BookingCheck = 1 Exit Function end if
i = -1 j = 0 Error = False
Redim Error_Array(1)
if not IsNumeric(Request.form("x_postnr")) then Error = True j = j + 1 ReDim Preserve Error_Array(j) Error_Array(j-1) = "x_postnr" end if if not IsNumeric(Request.form("x_Telefon")) then Error = True j = j + 1 ReDim Preserve Error_Array(j) Error_Array(j-1) = "x_Telefon" end if if Request.form("x_navn") = "" then Error = True j = j + 1 ReDim Preserve Error_Array(j) Error_Array(j-1) = "x_navn" end if if Request.form("x_adresse") = "" then Error = True j = j + 1 ReDim Preserve Error_Array(j) Error_Array(j-1) = "x_adresse" end if if Request.form("Afrejse") = "Vælg" or Request.form("Afrejse") = "" then Error = True j = j + 1 ReDim Preserve Error_Array(j) Error_Array(j-1) = "Afrejse" end if if Request.form("x_city") = "" then Error = True j = j + 1 ReDim Preserve Error_Array(j) Error_Array(j-1) = "x_city" end if if Request.form("Ankomst") = "Vælg" or Request.form("Ankomst") = "" then Error = True j = j + 1 ReDim Preserve Error_Array(j) Error_Array(j-1) = "Ankomst" end if if Request.form("flightnr") = "Vælg" or Request.form("flightnr") = "" then Error = True j = j + 1 ReDim Preserve Error_Array(j) Error_Array(j-1) = "flightnr" end if if Request.form("afrejsedato") = "Vælg" or Request.form("afrejsedato") = "" then Error = True j = j + 1 ReDim Preserve Error_Array(j) Error_Array(j-1) = "afrejsedato" end if if Request.form("depart") = "Vælg" or Request.form("depart") = "" then Error = True j = j + 1 ReDim Preserve Error_Array(j) Error_Array(j-1) = "depart" end if AntalV = Request.form("x_AntalVoksenSalg1") AntalB = Request.form("x_AntalBarnSalg1") AntalI = Request.form("x_AntalInfantSalg1") if AntalV = "" then AntalV = 0 end if if AntalB = "" then AntalB = 0 end if if AntalI = "" then AntalI = 0 end if tallet = int(AntalV+AntalB+AntalI) if tallet = 0 then Error = True j = j + 1 ReDim Preserve Error_Array(j) Error_Array(j-1) = "x_AntalVoksenSalg" end if if Request.form("Betbetingelser") = "" then Error = True j = j + 1 ReDim Preserve Error_Array(j) Error_Array(j-1) = "Betbetingelser" end if
if Error then BookingCheck = 1 Exit Function end if end Function
if trim(Request.form("flightnr1")) & "x" = "x" then response.write "" else Temp_des_fli2 = Split(Request.form("flightnr1"),":") xx_Destairlines1 = Temp_des_fli2(1) xx_flightnr1 = Temp_des_fli2(0) end if
tmpFld = Trim(x_besked) If trim(tmpFld) & "x" = "x" Then tmpFld = Null rs("nota") = tmpFld
tmpFld = Trim(x_Betbetingelser) If trim(tmpFld) & "x" = "x" Then tmpFld = Null rs("Betbetingelser") = tmpFld
tmpFld = Trim(x_adresse) If trim(tmpFld) & "x" = "x" Then tmpFld = Null rs("adresse") = tmpFld
tmpFld = Trim(x_navn) If trim(tmpFld) & "x" = "x" Then tmpFld = Null rs("navn") = tmpFld
tmpFld = x_postnr If Not IsNumeric(tmpFld) Then tmpFld = 0 rs("postnr") = cLng(tmpFld)
tmpFld = Trim(x_city) If trim(tmpFld) & "x" = "x" Then tmpFld = Null rs("city") = tmpFld
tmpFld = x_Telefon If Not IsNumeric(tmpFld) Then tmpFld = 0 rs("Telefon") = cLng(tmpFld)
tmpFld = x_total If Not IsNumeric(tmpFld) Then tmpFld = 0 rs("total") = cLng(tmpFld)
tmpFld = x_Profit If Not IsNumeric(tmpFld) Then tmpFld = 0 rs("Profit") = cLng(tmpFld)
tmpFld = Trim(x_email) If trim(tmpFld) & "x" = "x" Then tmpFld = Null rs("email") = tmpFld tmpFld = Trim(x_Deltager) If trim(tmpFld) & "x" = "x" Then tmpFld = Null rs("Deltager") = tmpFld
tmpFld = Trim(x_afrejse) If trim(tmpFld) & "x" = "x" Then tmpFld = Null rs("afrejse") = tmpFld tmpFld = Trim(x_afrejse1) If trim(tmpFld) & "x" = "Vælgx" Then tmpFld = Null rs("afrejse1") = tmpFld
tmpFld = Trim(x_ankomst) If trim(tmpFld) & "x" = "x" Then tmpFld = Null rs("ankomst") = tmpFld
tmpFld = Trim(x_ankomst1) If trim(tmpFld) & "x" = "x" Then tmpFld = Null rs("ankomst1") = tmpFld
tmpFld = x_afrejsedato If IsDate(tmpFld) Then rs("afrejsedato") = cDate(tmpFld) Else rs("afrejsedato") = Null End If
tmpFld = x_hjemrejsedato If IsDate(tmpFld) Then rs("hjemrejsedato") = cDate(tmpFld) Else rs("hjemrejsedato") = Null End If tmpFld = Trim(x_Destairlines) If trim(tmpFld) & "x" = "x" Then tmpFld = Null rs("Destairlines") = tmpFld
tmpFld = Trim(x_Destairlines1) If trim(tmpFld) & "x" = "x" Then tmpFld = Null rs("Destairlines1") = tmpFld
tmpFld = Trim(x_depart) If trim(tmpFld) & "x" = "x" Then tmpFld = Null else tmpFld = Left(tmpFld,2) & ":" & Right(tmpFld,2) end if rs("depart") = tmpFld
tmpFld = Trim(x_depart1) If trim(tmpFld) & "x" = "x" Then tmpFld = Null else tmpFld = Left(tmpFld,2) & ":" & Right(tmpFld,2) end if rs("depart1") = tmpFld
tmpFld = Trim(x_arrival1) If trim(tmpFld) & "x" = "x" Then tmpFld = Null else tmpFld = Left(tmpFld,2) & ":" & Right(tmpFld,2) end if rs("arrival1") = tmpFld
tmpFld = Trim(x_arrival) If trim(tmpFld) & "x" = "x" Then tmpFld = Null else tmpFld = Left(tmpFld,2) & ":" & Right(tmpFld,2) end if rs("arrival") = tmpFld
tmpFld = Trim(x_terminal) If trim(tmpFld) & "x" = "x" Then tmpFld = Null rs("terminal") = tmpFld
tmpFld = Trim(x_terminal1) If trim(tmpFld) & "x" = "x" Then tmpFld = Null rs("terminal1") = tmpFld
tmpFld = Trim(x_flightnr) If trim(tmpFld) & "x" = "x" Then tmpFld = Null rs("flightnr") = tmpFld
tmpFld = Trim(x_flightnr1) If trim(tmpFld) & "x" = "x" Then tmpFld = Null rs("flightnr1") = tmpFld
tmpFld = x_Betsenest If IsDate(tmpFld) Then rs("Betsenest") = cDate(tmpFld) Else rs("Betsenest") = Null End If
TotalFld=0 tmpFld = x_PrisVoksenSalg If Not IsNumeric(tmpFld) Then tmpFld = 0 rs("PrisVoksenSalg") = cDbl(tmpFld) TotalFld=TotalFld+cDbl(tmpFld)
tmpFld = x_AntalVoksenSalg If Not IsNumeric(tmpFld) Then tmpFld = 0 rs("AntalVoksenSalg") = cLng(tmpFld) TotalFld=TotalFld*cDbl(tmpFld)
tmpFld = x_Provision If Not IsNumeric(tmpFld) Then tmpFld = 0 rs("Provision") = cDbl(tmpFld) TotalFld=TotalFld+cLng(tmpFld)
rs("TotalSalgVoksen") = TotalFld
TotalFld=0 tmpFld = x_PrisBarnSalg If Not IsNumeric(tmpFld) Then tmpFld = 0 rs("PrisBarnSalg") = cDbl(tmpFld) TotalFld=TotalFld+cDbl(tmpFld)
tmpFld = x_AntalBarnSalg If Not IsNumeric(tmpFld) Then tmpFld = 0 rs("AntalBarnSalg") = cLng(tmpFld) TotalFld=TotalFld*cDbl(tmpFld)
rs("TotalSalgbarn") = TotalFld
TotalFld=0 tmpFld = x_PrisInfantSalg If Not IsNumeric(tmpFld) Then tmpFld = 0 rs("PrisInfantSalg") = cDbl(tmpFld) TotalFld=TotalFld+cDbl(tmpFld)
tmpFld = x_AntalInfantSalg If Not IsNumeric(tmpFld) Then tmpFld = 0 rs("AntalInfantSalg") = cLng(tmpFld) TotalFld=TotalFld*cDbl(tmpFld)
TotalFld=0 tmpFld = x_PrisVoksenSalg If Not IsNumeric(tmpFld) Then tmpFld = 0 rs("PrisVoksenSalg") = cDbl(tmpFld) TotalFld=TotalFld+cLng(tmpFld)*rs("antalVoksenSalg")
tmpFld = x_PrisBarnSalg If Not IsNumeric(tmpFld) Then tmpFld = 0 rs("PrisBarnSalg") = cDbl(tmpFld) TotalFld=TotalFld+cLng(tmpFld)*rs("antalbarnSalg")
tmpFld = x_PrisInfantSalg If Not IsNumeric(tmpFld) Then tmpFld = 0 rs("PrisInfantSalg") = cDbl(tmpFld) TotalFld=TotalFld+cDbl(tmpFld)*rs("antalinfantSalg")
TotalFld=0 tmpFld = x_PrisVoksenSalg If Not IsNumeric(tmpFld) Then tmpFld = 0 rs("PrisVoksenSalg") = cDbl(tmpFld) TotalFld=TotalFld+cLng(tmpFld)*rs("antalVoksenSalg")
tmpFld = x_PrisBarnSalg If Not IsNumeric(tmpFld) Then tmpFld = 0 rs("PrisBarnSalg") = cDbl(tmpFld) TotalFld=TotalFld+cLng(tmpFld)*rs("antalbarnSalg")
tmpFld = x_PrisInfantSalg If Not IsNumeric(tmpFld) Then tmpFld = 0 rs("PrisInfantSalg") = cDbl(tmpFld) TotalFld=TotalFld+cDbl(tmpFld)*rs("antalinfantSalg")
tmpFld = x_Depositium If Not IsNumeric(tmpFld) Then tmpFld = 0 rs("Depositium") = cDbl(tmpFld) TotalFld=TotalFld-cLng(tmpFld)
tmpFld = Trim(x_forsikring) If trim(tmpFld) & "x" = "x" Then tmpFld = Null rs("forsikring") = tmpFld forsikringtemp = tmpFld
rs("Restbelob") = TotalFld+forsikringtemp
tmpFld = Trim(x_medarbejder) If trim(tmpFld) & "x" = "x" Then tmpFld = Null rs("medarbejder") = tmpFld
tmpFld = x_Totalalle If Not IsNumeric(tmpFld) Then tmpFld = 0 rs("Totalalle") = cDbl(tmpFld)
tmpFld = Trim(x_Billetnummer) If trim(tmpFld) & "x" = "x" Then tmpFld = Null rs("Billetnummer") = tmpFld
TotalFld=0 tmpFld = x_PrisVoksenSalg If Not IsNumeric(tmpFld) Then tmpFld = 0 rs("PrisVoksenSalg") = cDbl(tmpFld) TotalFld=TotalFld+cLng(tmpFld)*rs("antalVoksenSalg") PrisVoksenSalgTemp = cDbl(tmpFld)
tmpFld = x_Provision If Not IsNumeric(tmpFld) Then tmpFld = 0 rs("Provision") = cDbl(tmpFld) TotalFld=TotalFld+cLng(tmpFld)
tmpFld = x_PrisBarnSalg If Not IsNumeric(tmpFld) Then tmpFld = 0 rs("PrisBarnSalg") = cDbl(tmpFld) TotalFld=TotalFld+cLng(tmpFld)*rs("antalbarnSalg") PrisBarnSalgTemp = cDbl(tmpFld)
tmpFld = x_PrisInfantSalg If Not IsNumeric(tmpFld) Then tmpFld = 0 rs("PrisInfantSalg") = cDbl(tmpFld) TotalFld=TotalFld+cLng(tmpFld)*rs("antalinfantSalg") PrisInfantSalgTemp = cDbl(tmpFld)
f.Antal_1.value = Antalfix1-(x_AntalVoksenSalg+x_AntalBarnSalg) <% if request.form("Afrejse1") = "" or Request.form("Afrejse1") = "Vælg" then response.write "" else %> f.Antal_2.value = Antalfix2-(x_AntalVoksenSalg+x_AntalBarnSalg) <% end if %> Antal1eren = (f.Antal_1.value!="")?+f.Antal_1.value:0; if (Antal1eren < 1) { alert("Billetantallet er 0!"); } <% if request.form("Afrejse1") = "" or Request.form("Afrejse1") = "Vælg" then response.write "" else %> Antal2eren = (f.Antal_2.value!="")?+f.Antal_2.value:0; if (Antal2eren < 1) { alert("Billetantallet er 0!"); } <% end if %> }
For i bund og grund kan din sagtens være rigtig.... Og det har ikke noget med databasen at gøre, men mere den måde APS håndtere den connection, så når alt kommer til (efter hvad jeg har fundet) så er det fordi din kode ikke er optimeret til serveren......
Her er hvad jeg fandt:
this is my solution I have discovered:
ASP is full of bugs, as I discovered lately, but these bugs can be solved by writing code.
My problem was due to Database connections, it seem to me I was doing the perfect thing, opening connections, recordsets, executing queries and finally I destroy every object I create.
THE PROBLEM =========== If you open only one connection (as I used to do), and run more than one query or recordsets at the same time, what is happening? ASP does not allow you to run more than one query through the same connection at the same time, (though it seems that it is working) so how come? Since ASP does not allow that, it creates its own connections to run the further queries you are executing, and after you are done with them, ASP is not destroying the connections it creates. If you are not destroying your connection objects as well, so you are helping the problem to come up.
WHAT IS HAPPENING ================== unclosed objects will create a resource leak in memory, and as the times goes, more objects are not closed, and more memory resources are consumed until it reaches to the maximum. And guess what, the famous message will show up! :rolleyes:
SOLUTION ========= -Define a connection for every query by its own. -Create you connection object and destroy them your self, don't let ASP do any thing by its self. :D
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.