My code does not work…
The connection seems to be… i have the msgbox…
but the insert… no…
[code] Dim db As New PostgreSQLDatabase
db.Host = “postgresql-papatch.alwaysdata.net”
db.Port = 5432
db.DatabaseName = “"
db.Username = "”
db.Password = “**”
If db.Connect Then
MsgBox “Connexion OK”
Else
MsgBox(“The connection failed.”)
End If
checking for errors is something you need to do because bad sql etc can cause your insert to fail (which is what I expect is happening)
If you never check then you can be surprised when things dont insert like you expect them to
and that was exactly the problem you had
[quote=333214:@Norman Palardy]checking for errors is something you need to do because bad sql etc can cause your insert to fail (which is what I expect is happening)
If you never check then you can be surprised when things dont insert like you expect them to
and that was exactly the problem you had[/quote]
yes !! thanks a lot !
In Postgresql, if you can, name the fields in lowercase. It makes it a lot more simple. Also make age numeric. Then the instruction becomes.
“INSERT INTO test (nom, prenom, age) VALUES (‘DUPONT’, ‘JEAN’,33);”
Much easier to read.
True. Which doesn’t mean transactions are a very powerful mechanism in case you have to update more than one record and you don’t want anything to be changed if anything goes wrong.