Home All Groups Group Topic Archive Search About

SQLDMO - SQLServer.Databases.Item

Author
31 Aug 2006 9:48 PM
Maer
Hi guys - I've been having a strange problem with one of our clients. I
use sqldmo (in c#) for some administrative tasks. I am able to create an
SQLServer object and connect just fine. However, there is a problem when it
reaches the code where I try to get a database object such as

    dbOject = svr.Databases.Item("appdatabase","dbo")

    The error says "server user 'username' is not a valid user of database
'OnCall'."

    This 'OnCall' database is another database in the server but it is not
referenced anywhere in the application. Sometimes the error gives another
database name.
    After tracing the code, I find out the this error occurs when trying to
get this object.

    First, this problem only happens with this client and is very sporadic,
it comes and goes. Sometimes it will go away by just connecting to the
database itsef in Enterprise Manager. I haven't been able to reproduce it in
my environment.

    Everything seems to be fine with the database itself. I can create an
ODBC connection and it tests successfully.

    Any thoughts? I would immensely appreciate any help on this as I have
run out of ideas.

    Thank you,
    Maer

AddThis Social Bookmark Button