04. oktober 2001 - 09:57Der er
5 kommentarer og 1 løsning
Database connetion med acess\"
Får ikke koblet til databasen hvis jeg bruker global.asa
DETTE LIGGER I GLOBAL.ASA -------------------------
\'Åpner database oppkobling. Sub Application_OnStart Set Application(\"oConn\")=Server.CreateObject(\"ADODB.Connection\") Application(\"oConn\").Open \"Driver={Microsoft Access Driver (*.mdb)};dbq=\" & Server.MapPath(\"database.mdb\") End Sub
\'Lukker database oppkobling. Sub Application_OnEnd Application(\"oConn\").Close Set Application(\"oConn\") = Nothing End Sub
DETTE LIGGER DB_TEST.ASP -------------------------
<html><body>
<% sql = \"SELECT * FROM Site\"
Set oRS=Application(\"oConn\").Execute( sql )
%>
<table border=1> <% Do While NOT oRS.EOF Response.Write \"<tr>\" Response.Write \"<td>\" & oRS(\"Heading\") & \"</td>\" Response.Write \"<td>\" & oRS(\"HovedTekst\") & \"</td>\" Response.Write \"<td>\" & oRS(\"SideId\") & \"</td>\" Response.Write \"</tr>\"
oRS.MoveNext Loop
%> </table> <% Set oConn = Nothing %> </body></html>
FEILMELDING ER I DENNE LINJEN! ------------------------------
Application_OnStart bliver kørt inden den første Session bliver kørt ikke inden hver Session.
Note This event can only be called once, by the first session that starts the application.
Synes godt om
Ny brugerNybegynder
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.