Hej Glenovic,
Jeg har fundet det her eksempel, hvor der opdateres i DB når går on og off.
Så må du prøve at sætte dine egne værdier ind, eller give os nogle flere oplysninger om hvordan din kode ser ud.
Sub Application_OnStart
Application("db") = "Data Source="&Server.Mappath("database.mdb")&_
";Provider=Microsoft.Jet.OLEDB.4.0;"
End Sub
Sub Session_OnStart
Session("bruger") = Replace(Request.Form("bruger"),"'","''")
Session("kode") = Replace(Request.Form("kode"),"'","''")
Dim Conn, rs
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open Application("db")
Set rs = Conn.Execute("Select * From tabel Where bruger = '"&_
Session("bruger")&"' And kode = '"&Session("kode")&"'")
If not rs.eof Then
Session("id") = rs("Id")
Conn.Execute("Update tabel Set online = True Where Id = "&Session("id"))
Else
Session.Abandon
Response.Redirect "login.html"
Conn.Close
Set Conn = Nothing
End If
Conn.Close
Set Conn = Nothing
End Sub
Sub Session_OnEnd
Dim Conn
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open Application("db")
Conn.Execute("Update tabel Set online = False Where Id = "&Session("id"))
Conn.Close
Set Conn = Nothing
End Sub
Det er taget fra:
http://www.a-begynder.dk/artikler/diverse/global-asa.htm