Skip to content
Advertisement

sql golang invalid memory address or nil pointer dereference when do query

i am trying to insert data after the connection, when i command the logic of INSERT... i was able to connect to the database, but when i uncommand them , i got error

here is my function :

I have tried to do the same thing also like this article go sql and have the same issue do I wrong implement this?

Advertisement

Answer

I bet a dollar/euro/frank that the NPE is on the line executing the prepared statement and that if you check the only error you ignored it won’t be nil and it will tell you what’s wrong.

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement