MarioGV
12 days agoNew Contributor III
how can I close a database connection
cHi All, good day.
I'm using a database connection and it's working good:
Dim dt As DataTable = Nothing
Dim dbConnApp As DbConnInfo = BRApi.Database.CreateDbConnInfo(_si, Dblocation.External, "OneStream BI Blend")
Dim stringSQL As String= "SELECT Entity,UD1_01,UD1_02,UD1_03,UD1_04,UD1_05,UD1_06,UD1_07,UD1_08,UD1_09,UD1_10,UD1_11,UD1_12,UD1_13,UD1_14,UD1_15 from XFC_UD1sbyEnt where Entity = " & "'" & api.Pov.Entity.Name & "' ; "
dt = BRapi.Database.ExecuteSql(dbConnApp, stringSQL.ToString, False)
but in the error message log have a lot of messages that I need to close the connection
Summary: Error in DbConnInfo.~DbConnInfo(). DbConnInfo should be used in a 'using' statement or Close() should be called explicitly.
does someone know how should be the command for close the connection?
Thanks in advance and best Regards.
Mario Guerrero
hi All, after several tests and SQL readings, I found the solution, at the end it need to add a line:
dbConnApp.Close()
The database connection has closed and no error message.
I hope it could help somebody. Regards.