It's not likely that the wrong database was opened. What is more likely is that the project A database is polluted with information from project B - assuming that project A and project B aren't both in the same solution.
Assuming you don't have a solution/workspace that contains both project A and B, this could occur: - if you opened a file from the project B while you were in project A - if you add project B to the solution that holds project A - if your system include directories point to directories the hold files from project B - if project A has additional include directories that point to project B directories
It might also occur if you have "if solution is no empty" checked on the Projects | File handling page of the VA options dialog.
Probably should have asked first, but what version of VA are you using and in what IDE?