ApplyLogonInfo with named SQL Instance RRS feed

  • Question

  • OK, I've raised this issue in another thread, but may have overcomplicated the problem. Basically, I am using ApplyLogonInfo to change SQL 2005 databases at run-time. I set the .server and .database parameters to the server name and database name. If the server name is just the machine name, all works as it should. However, if SQL is running as a named instance, I specify the server name as


    If I do this, and use debug to track what is happening, after calling ApplyLogonInfo, the connection info reverts back to the original settings. Is there a restriction here, or am I doing something wrong?

    Interestingly, things seem to work partially, in that the report DOES actually get data from the new database. However, if I try to change the table names (to others with the same structure), I get a 'logon failed' error. If I use a default instance, everything works as it should, including changing the table names.
    Wednesday, December 10, 2008 10:24 AM