Groups | Blog | Home
all groups > sql server new users > may 2006 >

sql server new users : Cannot open database "mydb" requested by the login.


Sue Hoegemeier
5/5/2006 2:55:14 PM
To grant access to a SQL Server instance (SQL Express or
other versions), you need to add the account as a login in
SQL Server. You don't need to mess with permissions on the
database files or in the SQL Server directory.
Then to allow that login access to a database, you need to
add the login as a user in the database. Once you have done
that, you need to grant the whatever permissions are
necessary in the database.
Add the login PEN1800\ASPNET to your SQL Express instance.
Add PEN1800\ASPNET as a user to the database mydb
Grant whatever permissions are needed for PEN1800\ASPNET

-Sue

[quoted text, click to view]
cas
5/5/2006 9:30:38 PM
Hi,

I installed sqlserver 2005 express on windows server 2000 sp4.

I made a new database ("mydb") with sql server Management studio express
(not a mdf file).
I also defined tables and i can make and execute queries in sql server
Management studio express without problem.
I granted to account ASPNET all privileges on the directories of sql server
(read, write, modify..) in c:\program files\sql server.

But when i try to execute this aspx-code (aspnet 2.0) with IE,
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$
ConnectionStrings:mydbConnectionString %>"
SelectCommand="select col1 from table1;"></asp:SqlDataSource>

i get this error:
Cannot open database "madb" requested by the login. The login failed.
Login failed for user 'PEN1800\ASPNET'.
How to solve this?
Thanks
Cas

cas
5/6/2006 10:15:58 AM
Hi,
thanks for replying.
I'm new to this so sorry if it's a stupid question, but can i add the login
PEN1800\ASPNET to the SQL Express instance with 'sqlserver Management Studio
express' or i have to use sqlcmd and the command 'create login ..'.?
And about adding PEN1800\ASPNET as a user to the database mydb, can i do
that with 'sqlserver Management Studio express'?
Thanks
Cas


[quoted text, click to view]

Sue Hoegemeier
5/8/2006 11:55:01 AM
I don't know what you can and can't do with Management
Studio Express. When in doubt, just use sqlcmd as you can
certainly do it with t-sql statement.

-Sue

[quoted text, click to view]
AddThis Social Bookmark Button