I'm wild guessing here as I have almost no info to go on to with that snippet, but I can only suspect sDatabaseName is some global variable. If that is the case, just set a local variable to that global variable first and pass that one into the OpenWait method.