In msg box data is showing but when I use the variable the it is null

yes it contains the id that i want.
uipath7

@Mehrab_Hussain now show me query how you are giving.

This is query
“Select Location From [POS].[dbo].[Transit] where MID = ’ " +NewGid+”'"

this is the query that i can see while run in debug: @“Select Location From [POS].[dbo].[Transit] where MID = ’ 347f859d-a8d8-4779-b5fc-ab1f52e52f9c

@Mehrab_Hussain can you print it before passing to run query and show me