NilObjectException

Hello everybody,

When I want all select my data, db is NilObjet, Why ?
And I have an error : An exception of class NilObjetException was not handled. The application must shut down.

db is declare in properties like SQLiteDatabase

Somebody can help me with share screen or with TeamViewer ?
SKYPE : pierre-guy
Messages : pglecompte

Here is my code :

[code]If B_DataOpen Then
DataList.DeleteAllRows

Dim sql As String
sql = "SELECT * FROM PERSONNE"

Dim data As RecordSet
data = db.SQLSelect(sql)

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

If data <> Nil Then
  While Not data.EOF
    DataList.AddRow(_
    data.Field("ID").StringValue, _
    data.Field("Nom").StringValue, _
    data.Field("Prenom").StringValue, _
    data.Field("Naissance").StringValue,_
    data.Field("CA").StringValue)
    data.MoveNext
  Wend
  data.Close
End If

Else
MsgBox(“Create the database first, the table and add the data.”)
End If[/code]

Where in your code did you create/connect to a Database???

I can open my database.
Open/Close database is in another button.

But where is the definition of DB stored ?
If its a local variable in the other button then that would explain why it’s nil

Hi Norman,

It is in the same layout (window)

But I can’t paste a copyscreen (in this forum)

Impossible to help without more details.

But at the time of the exception. “DB” is either NOT been instantiated yet…
-OR- it has gone out of scope
-OR- it has been closed and destroyed
-OR- you are attempting to refer to another variable created in a different scope

It could also be that one of the fields you are referencing contains NULL. the conversion to StringValue would throw an NOE in that case.