Web app encountering closed database

Hi there…
I am writing in a web app an app to access a sqlite database I have stored in my special folders.

Whenever I try to write to it, I get an error message that the database is closed.
The Sqlite database has all the tables…

I’m trying to add insert a new record… I have done this really well before (but I was using MySQL databases).

here’s some code:

[code]data1(0)=TextField1.text 'Name
data1(1)=TextField2.text 'Contact Person
data1(2)=TextField7.text 'Telephone
data1(3)=TextField10.text 'email
data1(4)=TextField8.text 'fax
data1(5)=TextField9.text 'website
data1(6)=Textarea1.text 'address
data1(7)=TextField11.text 'Postcode

dim r as recordset

Dim db As New SQLiteDatabase
db.DatabaseFile=specialfolder.applicationdata.child(“Management”).child(“Db”)
Dim rs as RecordSet
dim rec as DatabaseRecord
rec = New DatabaseRecord

rec.Column(“Name”) = BodyCoporate(0)
rec.Column(“ContactPerson”) = BodyCoporate(1)
rec.Column(“Telephone”) = BodyCoporate(2)
rec.Column(“Fax”) = BodyCoporate(4)
rec.Column(“Email”) = BodyCoporate(3)
rec.Column(“Address”) = BodyCoporate(6)
rec.Column(“Postcode”) = BodyCoporate(7)
rec.Column(“Website”) =BodyCoporate(5)
db(“BodyCorporate”,rec)
db

If db Then
MsgBox("DB Error: " + AssetData.ErrorMessage)
End If

MsgBox “Your BodyCoporate is Saved”

Homepage.Show[/code]

Not seeing a If db.connect here or even a Call db.connect, so database is probably not open.