Hi friends.
I have created a DataBase and then a Table on my server: DB1 and myTB.
I was logged in by user1. I mean the creating process was done by user1.
user1 can execute any query such as "
Select * from myTB".
I have created another user: user2 ( I don't have access to user properties ! the server just allow me to create new user with no more option to change user properties ! )
now when I execute the same query I've mentioned above, I get this error message on line 2 (cmd.Exe... )
Error msg:
Invalid object name 'myTB'.
cmd = new SqlCommand("Select * from myTB", con);
cmd.ExecuteNonQuery();
so in my opinion, maybe I should give the proper permissions to user2. if so, HOW ?
remember that I can just execute query. I mean I should solve the problem just by sql-queries !
I've tried sth like this:
GRANT select ON myTB TO user2
but the problem is on !
SQL SERVER 2005
I'll appreciate any help.
thanks in advande.
1. I've logged in with user1, then create db and table (now user1 is the owner I think !)
2. I've created another user named user2.
3. my problem is user2 can't execute any query on the db and table that created by user1 ( user2 CAN connect to my database )
4. so, to solve the problem, I've logged in by user1 and tried this query:"GRANT select ON myTB TO user2" to grant the select permission to user2.
what was wrong with 4th step ? should I change any user ?