SQL Server Error

Hello Every Body

How r u

i face a problem so please any body help me

i create two data base in sql server 2012 and connent with ASP.net (VB.Net) both data base connections establish but one data base work perfectly but the other data base doest not wort when run query 

sql = "Select * from [Table]"
        con = New Conn_LM()
        Dim cmd As New SqlClient.SqlCommand(sql, con.returnCon)
        Dim DA As SqlClient.SqlDataAdapter = New SqlClient.SqlDataAdapter()
        DA.SelectCommand = cmd
        Dim DS As DataSet = New DataSet()
        DA.Fill(DS)

when run this error is this

Error "5" The Select permission was denied on the object

any body help me 

thanks in advance

July 22nd, 2015 12:47pm

Hello Rick Byham Please tell me in detail how to execute 

SELECT USER; to see verify the name of the user you connected as.

My error occur on this line i tell in detail

I create two data base in sql server 2012 and connect with ASP.net (VB.Net) both data base connections establish and one data base perform work (Select Insert ... and other commands) perfectly but the other data base does not work (Select Insert ...) when run query 

sql = "Select * from [Table]"
        con = New Connection()
        Dim cmd As New SqlClient.SqlCommand(sql, con.returnCon)
        Dim DA As SqlClient.SqlDataAdapter = New SqlClient.SqlDataAdapter()
        DA.SelectCommand = cmd
        Dim DS As DataSet = New DataSet()
        DA.Fill(DS)

when the cursor comes at last line (DA.Fill) then the error occur

1. Please tell how to check user permissions while the second database is also run perfectly and no error occur  

both r connect with the same user

i run this query

SELECT logins.name, roles.name
	FROM sys.server_principals logins 
		INNER JOIN sys.server_role_members rm ON logins.principal_id = rm.member_principal_id
		INNER JOIN sys.server_principals roles ON rm.role_principal_id = roles.principal_id
	WHERE logins.name = SUSER_SNAME()

 and see the result my name is sysadmin 

but the result same 

Free Windows Admin Tool Kit Click here and download it now
August 1st, 2015 2:41am

i am connect with sql as window authentication
August 1st, 2015 3:10am

Hello Rick Byham Please tell me in detail how to execute 

*SELECT USER;* to see verify the name of the user you connected as.

Change this line:

sql = "Select * from [Table]"

To

sql = "SELECT USER"

Free Windows Admin Tool Kit Click here and download it now
August 1st, 2015 4:12am

show dbo

August 1st, 2015 6:17am

Hello Rick Byham Please tell me in detail how to execute 

SELECT USER; to see verify the name of the user you connected as.

My error occur on this line i tell in detail

I create two data base in sql server 2012 and connect with ASP.net (VB.Net) both data base connections establish and one data base perform work (Select Insert ... and other commands) perfectly but the other data base does not work (Select Insert ...) when run query 

sql = "Select * from [Table]"
        con = New Connection()
        Dim cmd As New SqlClient.SqlCommand(sql, con.returnCon)
        Dim DA As SqlClient.SqlDataAdapter = New SqlClient.SqlDataAdapter()
        DA.SelectCommand = cmd
        Dim DS As DataSet = New DataSet()
        DA.Fill(DS)

when the cursor comes at last line (DA.Fill) then the error occur

1. Please tell how to check user permissions while the second database is also run perfectly and no error occur  

both r connect with the same user

i run this query

SELECT logins.name, roles.name
	FROM sys.server_principals logins 
		INNER JOIN sys.server_role_members rm ON logins.principal_id = rm.member_principal_id
		INNER JOIN sys.server_principals roles ON rm.role_principal_id = roles.principal_id
	WHERE logins.name = SUSER_SNAME()

 and see the result my name is sysadmin 

but the result same 

Free Windows Admin Tool Kit Click here and download it now
August 1st, 2015 6:36am

show dbo


Can you post the full error message text and stack trace of the error? 
August 1st, 2015 7:57am

Free Windows Admin Tool Kit Click here and download it now
August 2nd, 2015 2:06am

Thanks Dan

When i run "Select User" code from ASP.Net then the result is NT Authority\System

after adding domain name in NT Authority\System my problem is solved

thanks

but please give answer why run query by NT Authority\System user and how to change from this to dbo (computer name)


August 3rd, 2015 9:25am

Thanks Berimi

When i run "Select User" code from ASP.Net then the result is NT Authority\System

after adding domain name in NT Authority\System my problem is solved

thanks

but please give answer why run query by NT Authority\System user and how to change from this to dbo (computer name)



Free Windows Admin Tool Kit Click here and download it now
August 3rd, 2015 9:26am

When i run "Select User" code from ASP.Net then the result is NT Authority\System

after adding domain name in NT Authority\System my problem is solved

At least as long you have IIS and SQL Server on the same machine...

NT Authority\System comes from the fact that IIS runs under local system and you log in with Windows authentication.

I would guess that NT Authority\System is the owner of the other database.

August 3rd, 2015 5:12pm

i am runing this site on two machines

both machines run IIS and SQL Server on the same machine

but when run "Select User" query

one machine show result "dbo" and

 one machine show result "NT Authority\System"

Free Windows Admin Tool Kit Click here and download it now
August 4th, 2015 1:19am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics