locked
The SELECT permission was denied on the object '', database '', schema 'dbo'. RRS feed

  • Question

  • User-1052995518 posted

     hay there...

    i'm developing a website using visual studio 2005, when i run it from VS it works fine and it can access the DB.

    but when i make an alias and run it directly from localhost ..i keep getting this message when i try to fill a DATASET ..

    Line 198:        cmd.CommandText = "Select Line From Buses";
    Line 199: da.SelectCommand = cmd;
    Line 200: da.Fill(ds);
    can anyone help me ?

    thanx
     

    Tuesday, April 15, 2008 4:59 PM

Answers

  • User1421348797 posted

    Add the user ASPNET user to the SQL Server, and add it as a user to the database, with appropriate permissions.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, April 16, 2008 7:19 AM
  • User2008424322 posted

    Hi, 

    I fixed the error by assigning the default schema for the database to DBO.

    eg: Login to SQL using SA > Security > User > select username > properties
    Make sure that 'Users = username' & 'Schema = DBO'

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, April 16, 2008 7:23 AM
  • User-1727935884 posted

    Hi majd_wadi ,

    I did what u said, still not working !!!!!!! the problem is that when i run from VS2005 it works fine ..but when i make an alias and run it through local host directly it doesn't work !!!!???

    So, after you have add the asp.net working process account (generally speaking  aspnet in xp box and network service in a server box) into your sql server permission list, you still cannot access the database. Do I understand you right? If yes, I think then you need to check if you have set "immpersonate" in your asp.net authentication configuration (in web.config, check if this tag <identity immpersonate="true"> exist). If yes, you need to make sure that the login account which asp.net immersonated has accutall got the permission right to access your db.

    Hope my suggestion helps

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, April 20, 2008 10:20 PM

All replies

  • User1766749533 posted

    Hi, we need to check the connection information, how are you connecting. Its obvious that different information/user is taken one is going thru and other is complaining.

    Could you let us know about ur connection string.

    Tuesday, April 15, 2008 5:12 PM
  • User-1240255936 posted

    try to run the following though sql management studio (replace tblYourTableName with your table name) 

    grant select on dbo.tblYourTableName to public
     
    Tuesday, April 15, 2008 5:26 PM
  • User-1052995518 posted

    hi again, thx 4 reply. 

    this is the connection string ...i haven't made any users attached to the DB or anything .. 

     connectionString="Data Source=MAJD\SQLEXPRESS;Initial Catalog=MobileStudentPortal;Integrated Security=True" 

    Wednesday, April 16, 2008 7:11 AM
  • User1421348797 posted

    Add the user ASPNET user to the SQL Server, and add it as a user to the database, with appropriate permissions.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, April 16, 2008 7:19 AM
  • User2008424322 posted

    Hi, 

    I fixed the error by assigning the default schema for the database to DBO.

    eg: Login to SQL using SA > Security > User > select username > properties
    Make sure that 'Users = username' & 'Schema = DBO'

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, April 16, 2008 7:23 AM
  • User-1052995518 posted

    how can i login to SQL as SA ?

    i'm SQL management studio ..please explain me how ! 

    Thursday, April 17, 2008 4:17 PM
  • User2008424322 posted

    You can login using windows authentication also.

    Friday, April 18, 2008 12:18 AM
  • User-1052995518 posted
    I did what u said, still not working !!!!!!! the problem is that when i run from VS2005 it works fine ..but when i make an alias and run it through local host directly it doesn't work !!!!???
    Saturday, April 19, 2008 2:13 PM
  • User-1727935884 posted

    Hi majd_wadi ,

    I did what u said, still not working !!!!!!! the problem is that when i run from VS2005 it works fine ..but when i make an alias and run it through local host directly it doesn't work !!!!???

    So, after you have add the asp.net working process account (generally speaking  aspnet in xp box and network service in a server box) into your sql server permission list, you still cannot access the database. Do I understand you right? If yes, I think then you need to check if you have set "immpersonate" in your asp.net authentication configuration (in web.config, check if this tag <identity immpersonate="true"> exist). If yes, you need to make sure that the login account which asp.net immersonated has accutall got the permission right to access your db.

    Hope my suggestion helps

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, April 20, 2008 10:20 PM
  • User-1449539358 posted

    Add the user ASPNET user to the SQL Server, and add it as a user to the database, with appropriate permissions.

    Thanks, this worked for me! 

    Thursday, December 16, 2010 6:38 PM