All SQL DB statements need a sql.DB connection:

var conn *sql.DB = ...
defer conn.Close()

statement, err := conn.Prepare(SQL)


My question is, if I want to reuse the `conn` variable later on in the same 
function, 

conn, err = sql.Open("mssql", NewConnString)


Do I need to put another `defer conn.Close()` after it, or the first `defer 
conn.Close()` still applies? Or I should call `conn.Close()` explicitly 
beforehand? 

thanks

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/11c35ccc-0713-4e09-8325-a4e608758b15%40googlegroups.com.

Reply via email to