Hello Xojo community.
I am having a problem with my web app and I have no idea what could be causing the problem.
Test Page
[code]
Dim db As New PostgreSQLDatabase
db.Host = “hidden”
db.DatabaseName = “hidden”
db.UserName = “hidden”
db.Password = “hidden”
Dim ps As PostgreSQLPreparedStatement = _
db.Prepare(“SELECT * FROM pizza_orders;”)
Dim rs As RecordSet = ps.SQLSelect
If db.Error Then
MsgBox("DB Error: " + db.ErrorMessage)
return
Else
Label1.Text = rs.Field(“PizzaType”).StringValue
End If [/code]
When I get to this page I get a DB error with the following message: connection pointer is NULL.
I know my connection details are correct because when I execute the script below it works without any errors.
Ordering Page
Dim db As New PostgreSQLDatabase
db.Host = "hidden"
db.DatabaseName = "hidden"
db.UserName = "hidden"
db.Password = "hidden"
Dim ps As PostgreSQLPreparedStatement = _
db.Prepare("INSERT INTO pizza_orders (Name,PizzaType,Ranch) Values ($1,$2,$3);")
ps.Bind(0, NameBox.Text)
ps.Bind(1, PopupMenu1.Text)
ps.Bind(2, Checkbox1.Value)
ps.SQLExecute
db.SQLExecute("COMMIT")
If db.Connect Then
db.Close
testpage.show
Else
MsgBox(db.ErrorMessage)
Return
End If