Hello Everyone,
A call to connect to a PostgreSQL database gives the following error:
Here is the code which has this error:
[code] db = new PostgreSQLDatabase
db.host = “127.0.0.1”
db.port = 5432
db.DatabaseName = “Xojo_DB”
db.UserName = “XojoUser”
db.password = “secret”
If db.connect then
'The computer connected to the database
'MsgBox “Successfully connected to the database”
Else
MsgBox " can not connect to db "
Msgbox db.errormessage
Return
End If
Dim err as OLEException
MsgBox err.Message[/code]
There is a global property in Window1 that has the following:
db as PostgreSQLDatabase
I am guessing that I am missing something simple. The NilObjectException is shown with the bottom code highlighted with the IDE for the line MsgBox err.Message. If the OLEException is commented-out, the database will update, delete, and perform normally.
Does anyone have some helpful thoughts on what I need to do to prevent the NilObjectException from occurring and to offer insight on why this is happening?
Thanks for your help,
Eugene