Avatar billede dkkarpen Nybegynder
01. marts 2000 - 10:41 Der er 2 kommentarer og
1 løsning

Pludselig fejl i global.asa

Hvad nu må man spørge sig selv om...?

Min kode er følgende:

<script language="vbscript" runat=server>
Sub Application_OnStart
    'Tax percentage to add to order total
    Dim stax
    stax = 0.21
    Application("taxP") = stax
End Sub

Sub Application_OnEnd

End Sub

Sub Session_OnStart
    'Shopping cart array
    Const cartAttributes = 5
    Const maxCartItems = 10
    ReDim arrcart(cartAttributes,maxCartItems)

    Session("MyCart") = arrcart
    Session("cartItem") = 0

MinConnection = "PROVIDER=MSDASQL;DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & Server.MapPath("statistik.mdb") & ";UID=admin;PWD=;"
set minConn = server.CreateObject ("adodb.connection")
minConn.Open MinConnection

DateTimeEntrance = Now()
if len(Request.Cookies("Sample")) > 0 then
  CookieID = Request.Cookies("Sample")
else
  conn.execute "insert into cookies (DateCreated) " _
  & "values (#" & DateTimeEntrance & "#)"
  Set RSCookieID = conn.Execute("select CookieID from Cookies where " _
  & "DateCreated = #" & DateTimeEntrance & "#")
  CookieID = RSCookieID("CookieID")
  Response.Cookies("Sample") = RSCookieID("CookieID")
  Response.Cookies("Sample").Expires = #12/31/2000 00:00:00#
end if

set BC = server.createobject("MSWC.BrowserType")

IPAddress = Request.ServerVariables ("remote_addr")
UserAgent = Request.ServerVariables ("HTTP_USER_AGENT")
Browser = BC.Browser & "  " & BC.Version
DHTMLSupport = cstr(BC.dhtml)
FramesSupport = cstr(BC.frames)
TablesSupport = cstr(BC.tables)
CookiesSupport = cstr(BC.cookies)
BackgroundSounds = cstr(BC.backgrounds)
JavaScriptSupport = cstr(BC.javascript)
JavaAppletsSupport = cstr(BC.javaapplets)
ActiveXControlsSupport = cstr(BC.activexcontrols)
AOL = cstr(BC.aol)
Platform = cstr(BC.platform)
VBScriptSupport = cstr(BC.vbscript)

FullReferer = Request.ServerVariables("http_referer")
if len(FullReferer) <= 7 then
  RefererDomain = "-"
  RefererQuery = "-"
else
  SlashPosition = instr(8, FullReferer, "/")
  if SlashPosition = 0 then
    RefererDomain = FullReferer
    RefererQuery = "-"
  else
    RefererDomain = left(FullReferer, SlashPosition - 1)
    RefererQuery = right(FullReferer, len(FullReferer) - slashPosition)
  end if
end if

SQL = "insert into Visitors (DateTimeEntrance, IPAddress, UserAgent, Browser, "
SQL = SQL & "DHTML, Frames, Tables, Cookies, BackgroundSounds, Javascript, "
SQL = SQL & "JavaApplets, ActiveXControls, AOL, Platform, VBScript, "
SQL = SQL & "RefererDomain, RefererQuery, CookieID) values ("
SQL = SQL & "'" & DateTimeEntrance & "', "
SQL = SQL & "'" & IPAddress & "', "
SQL = SQL & "'" & UserAgent & "', "
SQL = SQL & "'" & Browser & "', "
SQL = SQL & "'" & DHTMLSupport & "', "
SQL = SQL & "'" & FramesSupport & "', "
SQL = SQL & "'" & TablesSupport & "', "
SQL = SQL & "'" & CookiesSupport & "', "
SQL = SQL & "'" & BackgroundSounds & "', "
SQL = SQL & "'" & JavaScriptSupport & "', "
SQL = SQL & "'" & JavaAppletsSupport & "', "
SQL = SQL & "'" & ActiveXControlsSupport & "', "
SQL = SQL & "'" & AOL & "', "
SQL = SQL & "'" & Platform & "', "
SQL = SQL & "'" & VBScriptSupport & "', "
SQL = SQL & "'" & RefererDomain & "', "
SQL = SQL & "'" & RefererQuery & "', "
SQL = SQL & "'" & CookieID & "')"
minConn.Execute SQL

Set RSRecordID = minConn.Execute("select RecordID from Visitors where DateTimeEntrance = #"_
& DateTimeEntrance & "#")
Session("RecordID") = clng(RSRecordID("RecordID"))
End Sub

Sub Session_OnEnd
Connection = "PROVIDER=MSDASQL;DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & Server.MapPath("statistik.mdb") & ";UID=admin;PWD=;"
set conn = server.CreateObject ("adodb.connection")
Conn.Open Connection
Connection.execute "update Visitors set DateTimeExit = #" & Now() _
& "# where RecordID = " & Session("RecordID")
End Sub
</script>

Fejlbesked er:

ADODB.Field error '800a0bcd'

Either BOF or EOF is True, or the current record has been deleted; the operation requested by the application requires a current record.

//global.asa, line 97

Linie 97: Session("RecordID") = clng(RSRecordID("RecordID"))

Hvad går nu galt???
Avatar billede dkkarpen Nybegynder
01. marts 2000 - 13:28 #1
Det kan lige nævnes at RecordID er autonumber. Og der kommer værdier i tabellen "visitors".
Avatar billede dkkarpen Nybegynder
01. marts 2000 - 13:46 #2
SÅ vidt jeg kan se er clng(RSRecordID") tom. Men tabellen den skal hente værdien fra er IKKE.
Avatar billede dkkarpen Nybegynder
08. marts 2000 - 12:13 #3
lukket
Avatar billede Ny bruger Nybegynder

Din løsning...

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.

Loading billede Opret Preview
Kategori
Kurser inden for grundlæggende programmering

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester