SELECT permission denied...

G

Guest

Hi all,

I’m an ASP developer but I just started to try and learn ASP.NET. I have
the following code but it seems like I have a permissions problem.

<%@ Page Language="VB" Debug="true" %>
<%@ import namespace="System.Data" %>
<%@ import namespace="System.Data.SqlClient" %>

<%
Dim connWebLinks As New SqlConnection("Data Source=(local);Initial
Catalog=dbWebLinks;Integrated Security=SSPI")
Dim Cmd As New SqlCommand("SELECT * FROM tblLinks", connWebLinks)
connWebLinks.Open
Dim myReader = Cmd.ExecuteReader()

myReader.Close
connWebLinks.Close
%>

I get this error:

System.Data.SqlClient.SqlException: SELECT permission denied on object
'tblLinks', database 'dbWebLinks', owner 'dbo'.

I have added <computer name>\ASPNET to the ‘users’ for the database
‘dbWeblinks’ in SQL Server and given it all the permissions I can see, this
includes SELECT on the table ‘tblWeblinks’.

Can anyone help me?

Thanks,

Steve
 
K

Kevin Spencer

Did you ADD the user or did you SELECT the user? SQL Server supports 2 types
of user accounts: SQL Server and Windows. If you type in what you told us
you added, you aren't selecting a Windows user; you're creating a SQL Server
user. Since you're using Integrated Security, you would need to SELECT the
Windows account, and grant that the necessary permissions.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
I get paid good money to
solve puzzles for a living
 
G

Guest

When you say that you gave every permission, you didn't by chance accidently
give them "deny_datareader" did you? The datareader permission is what is
needed for that.
 
G

Guest

Thanks for the reply kevin...

I'm pretty sure i added the account by selecting it, and that i didn't
create a new sql server account, however i have since removed the account,
and added (by selecting) it again and it now works fine. Maybe i did create
the sql account as you suggest, by accident.

Anyway thanks for your help on this one :)

Steve
 
G

Guest

Thanks for the reply Scott, no i didn't touch the role membership so maybe
my statement about giving it all permissions was wrong... The only ones i
changed were the select/update etc on the table...

Thanks again though... :)

Steve
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,763
Messages
2,569,562
Members
45,038
Latest member
OrderProperKetocapsules

Latest Threads

Top