Operation cannot be completed because the database is closed.

I am stumped on this… everything works on the dev machine… except this:

[code]’ *****************************************************
’ Author: The “Dude” Exists
’ System: Linux Mint
’ Owner: The “Dude” Exists
’ E-Mail: thedudeexists@emailaddress.net
’ Phone: (999) 888-6666
’ *****************************************************
// Preliminary code…

’ – : NONE DEFINED : –

// Variable declarations…
Var fldrItem As FolderItem
Var txtInput As TextInputStream
Var rowFromFile, oneCell As String
Var dbRow As New DatabaseRow

// Functions…
fldrItem = FolderItem.ShowOpenFileDialog(“text/plain/csv”) // defined as a FileType

If fldrItem <> Nil Then
txtInput = TextInputStream.Open( fldrItem ) // Read the input stream into a file…
txtInput.Encoding = Encodings.UTF8 // Set encoding…

Var strRead As String = txtInput.ReadAll // Read the newly encoded
txtInput.Close // Close the input stream
strRead = Trim( strRead ) // Trim off trailing/leading blanks
strRead = ReplaceLineEndings( strRead, EndOfLine ) // Can’t remember… but I need this line…

Var strLine( ) As String = Split( strRead, EndOfLine ) ’ Break down to individual lines and load into array for further processing…

For A As Integer = 0 To UBound( strLine ) // Loop until all lines are completed…
Dim strField( ) As String = Split( strLine( A ),"," ) ’ Separate out each field value from each line…

// Add input for insert query....
dbRow.Column("barcode").StringValue = strField( 0 )
dbRow.Column("plantNomen").StringValue =  strField( 1 )
dbRow.Column("tillCategory").StringValue =  strField( 2 )

Try
  dbJHGCGC.AddRow("tblPlantInfo", dbRow)
Catch error As DatabaseException
  MessageBox("DB Error: " + error.Message)
End Try

Next
End If[/code]

I get this error: “Operation cannot be completed because the database is closed.” – yet I can insert new records from input fields, update and so forth… I have a simple 3 column csv I am trying to import into an existing table…

The example code does not show where dbJHGCGC is defined or its scope. Presumably it is defined and opened elsewhere. Put a breakpoint somewhere ahead of the For loop and examine dbJHGCGC. Sounds like it is already closed at that point. Then back up to the code that opens the DB and follow the execution flow to determine where it is getting closed before you get to this block of code.

I figured it out… I was trying to execute the load function before the app had completed it’s start up cycle…