Is the pain dental? Muscular? Arthritis? Injury? Where? When? Duration? I'm sure I missed several possibilities. Different pain treatments work for different things. Just like us.
Definitely go with your vet. Bear in mind, also, that some meds do not agree with some dogs. When Belle had Tramadol, for instance, she went off her legs. It was very worrying as she was already ill and we hadn't been warned about the possible side effects. Do ask your vet what side effects your dog may get.