How to UPDATE a column field through Npgsql

mauede

Well-known member
Joined
Sep 1, 2021
Messages
103
Location
Northwood - UK
Programming Experience
Beginner
I made some little progress with a lot of sweat. I can list the content of a column in a selected table and allow the user to pick a column item.
Thanks for your help.

My new challenge is to implement a method that allows the user to change the name of an existent trial (that is an item in a specific column of a table).
The table in question is called "trial". The column called "trial_name" contains 3 items (that is 3 rows):
  • Pathos
  • Concorde
  • Adscan
Let's assume the user has picked "Pathos".
Let's assume the user wants to change the name "Pathos" to "JohnDow".
I will have to make sure an existent trial has been selected and if so I will have to replace the name "Pathos" with "JohnDow".
I cannot find the appropriate Npgsql command to do that.
Can you please help?
Thank you in advance
 
Unless PostgreSql or Npgsql has a bug, the same connection should be usable for read and write without having to close it.
Apparently this not a "bug", but rather a "feature".


And the easy solution is to use SELECT ... FOR UPDATE, and the harder solution is to use SERIALIZABLE mode.

 
After further readings in Github, the Npgsql developers recommends doing a first pass in one connection doing all the reads and storing what you need in memory, and then doing a second pass to do the updates with a new connection.
 
Back
Top Bottom