Hast n Mix zwischen Globalen und Lokalen Variablen...

So funktioniert's.

MfG

Christian

New Code:

Function openDB(ByRef DBPath, ByRef DB)
  DBPath = getDBPath(DBPath)
  Set DB = Server.CreateObject("ADODB.Connection")
  DB.open "Provider=Microsoft.Jet.OLEDB.4.0;Jet OLEDB:Engine Type=5;Data
Source=" & DBPath
End Function

Function openDB(ByRef DBPath, ByRef DB)
  DBPath = getDBPath(DBPath)
  Set DB = Server.CreateObject("ADODB.Connection")
  DB.open "Provider=Microsoft.Jet.OLEDB.4.0;Jet OLEDB:Engine Type=5;Data
Source=" & DBPath
End Function

Function closeDB(ByRef DB)
  DB.close
  set DB = nothing
End Function

der include in der global.asa:
<SCRIPT LANGUAGE="VBScript" RUNAT="Server"
SRC="library/dbmaintaining.asa"></SCRIPT>

Dann der Aufruf:
    Dim DB
    Dim DBPath
    DBPath = "db\test.mdb"
    'on Session start
    createDB(DBPath, DB)
    openDB(DBPath, DB)
    closeDB(DB, DB)

> -----Original Message-----
> From: Mathias Becker [mailto:[EMAIL PROTECTED]]
> Sent: Dienstag, 14. Mai 2002 08:26
> To: ASP Datenbankprogrammierung
> Subject: [aspdedatabase] Werum funktioniert mein DB.close 
> nicht?? (alt:
> RE: AW: Access DB mit Asp generieren?)
> 
> 
> Hallo!
> 
> Irgendwie funktioniert das beides nicht.
> 
> Also folgendes wird gemacht:
> 
> Die Funktionen:
> 
> Function openDB(DBPath)
>   DBPath = getDBPath(DBPath)
>   Set DB = Server.CreateObject("ADODB.Connection")
>   DB.open "Provider=Microsoft.Jet.OLEDB.4.0;Jet OLEDB:Engine 
> Type=5;Data
> Source=" & DBPath
> End Function
> 
> Function openDB(DBPath)
>   DBPath = getDBPath(DBPath)
>   Set DB = Server.CreateObject("ADODB.Connection")
>   DB.open "Provider=Microsoft.Jet.OLEDB.4.0;Jet OLEDB:Engine 
> Type=5;Data
> Source=" & DBPath
> End Function
> 
> Function closeDB(DB)
>   DB.close
>   set DB = nothing
> End Function
> 
> der include in der global.asa:
> <SCRIPT LANGUAGE="VBScript" RUNAT="Server"
> SRC="library/dbmaintaining.asa"></SCRIPT>
> 
> Dann der Aufruf:
>     Dim DB
>     Dim DBPath
>     DBPath = "db\test.mdb"
>     'on Session start
>     createDB(DBPath)
>     openDB(DBPath)
>     closeDB(DB)
> 
> Und der Fehler ;)
> 
> Microsoft VBScript runtime error '800a01a8' 
> 
> Object required: 'DB' 
> 
> //library/dbmaintaining.asa, line 28 
> 
> Line 28 ist der DB.close Befehl in der Function closeDB
> 
> 
> Mit freundlichen Gr�ssen 
> 
> Mathias Becker
> [EMAIL PROTECTED]
> 
> > -----Urspr�ngliche Nachricht-----
> > Von: Claudius Ceteras [mailto:[EMAIL PROTECTED]] 
> > Gesendet: Montag, 13. Mai 2002 21:56
> > An: ASP Datenbankprogrammierung
> > Betreff: [aspdedatabase] RE: AW: Access DB mit Asp generieren?
> > 
> > 
> > Oder besser: immer die DB mit als Argument an die Funktion 
> > �bergeben...
> > 
> > Claudius
> > 
> > > 
> > > Hallo,
> > > 
> > > > Dbopen funktioniert soweit => DB wird ge�ffnet das Object
> > > heist DB. Nun
> > > > mein Problem:
> > > > Das Object DB ist in keiner anderen Funktion bekannt
> > > (Object required:
> > > > 'DB' ). Da ich im Mom. ziemlich aufm Schlauch stehe hilft
> > > mir vielleicht
> > > > mal jemand meinen Gehirnknoten zu zerschlagen? ;) (Bitte
> > > nicht w�rtlich
> > > > nehmen ;)) )
> > > 
> > > Global definieren?
> > > 
> > > Au�erhalb der DBOpen-Prozedur:
> > > 
> > > <%
> > >  Dim DB
> > > %>
> > > 
> > > MfG,
> > > Markus Oestreicher [QualityHosting Support]
> > > -------------------------------------------
> > >     jetzt mit ASP.NET Unterst�tzung
> > > Informationen: http://www.qualityhosting.de
> > > 
> > > 
> > > 
> > > 
> > > | [aspdedatabase] als [EMAIL PROTECTED] subscribed 
> > > | http://www.aspgerman.com/archiv/aspdedatabase/ = 
> Listenarchiv Sie 
> > > | k�nnen sich unter folgender URL an- und abmelden: 
> > > | 
> > http://www.aspgerman.com/aspgerman/listen/anmelden/aspdedataba
> se.asp
> > 
> 
> 
> | [aspdedatabase] als [EMAIL PROTECTED] subscribed 
> | http://www.aspgerman.com/archiv/aspdedatabase/ = Listenarchiv Sie 
> | k�nnen sich unter folgender URL an- und abmelden: 
> | http://www.aspgerman.com/aspgerman/listen/anmelden/aspdedatabase.asp
> 
> 
> | [aspdedatabase] als [EMAIL PROTECTED] subscribed
> | http://www.aspgerman.com/archiv/aspdedatabase/ = Listenarchiv
> | Sie k�nnen sich unter folgender URL an- und abmelden:
> | http://www.aspgerman.com/aspgerman/listen/anmelden/aspdedatabase.asp
> 

| [aspdedatabase] als [email protected] subscribed
| http://www.aspgerman.com/archiv/aspdedatabase/ = Listenarchiv
| Sie k�nnen sich unter folgender URL an- und abmelden:
| http://www.aspgerman.com/aspgerman/listen/anmelden/aspdedatabase.asp

Antwort per Email an