I got the problem, which lots of people might encounter before.
In my case, I use login control and sqlexpress to build a login page.
when password & user name were entered. It gave me:
"Cannot open user default database, login fails"
The solution given by msdn is:
SQL Server 2005
You can use the sqlcmd utility to change the default database in SQL Server 2005. To do this, follow these steps:the SQL Server login uses Microsoft Windows authentication to connect
to the instance, type the following at the command prompt, and then
press ENTER:
sqlcmd –E -S InstanceName –d master
the SQL Server login uses SQL Server authentication to connect to the
instance, type the following at the command prompt, and then press
ENTER:
sqlcmd -S InstanceName -d master -U SQLLogin -P Password
ALTER LOGIN SQLLogin WITH DEFAULT_DATABASE = AvailDBName
Note AvailDBName is a placeholder for the name of the existing database that can be accessed by the SQL Server login in the instance.I wonder what are InstanceName, SQLLogin & AvailDBName. It would be nice if someone can give me a specific example, since I am not sure how to type them in a command line. :)
You're in the wrong forum. Try here: http://forums.microsoft.com/MSDN/ShowForum.aspx?ForumID=84&SiteID=1
-Jamie
No comments:
Post a Comment