I wrote a simple c# code that connect to sql-server database and execute a query:
cmd = new SqlCommand(txtQuery.Text.ToString().Trim(), con);
- in my db I have a table named myTB. I have two users too: user1(owner), user2(new user created)
- I logged in
(connected to DB) with user2
's username and password !
- I can access the tables that <b1>created by user1 by the query bellow:
"select * from user1.myTB"
(I don't know why I get error with this query:"select * from myTB", forget it now!)
- Now I wanna REVOKE
'select' permission from user2. I mean I don't want user2 to execute the select query
on myTB table which is created by user1.
- what should I do is a problem that I'm stuck on it !
I used this query, but nothing changed !
Q1: "Revoke select ON user1.myTB FROM user2"
again user2 can do select * from user1.myTB !!! WHY !?
please help me with this.