Author |
Topic |
hemaljoes
Starting Member
7 Posts |
Posted - 2010-08-05 : 14:15:09
|
Hi I want to Execute GRANT SELECT ON TableName TO [Domain\UserName]in my ASP.net page ( in the .cs)How can I give the [Domain\UserName] in the CommandText |
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
hemaljoes
Starting Member
7 Posts |
Posted - 2010-08-05 : 15:16:19
|
What my requirement is to allow a top level users to grant permission to other users SELECT,INSERT,DELETE rights on a particular tableThanks in advanced |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
hemaljoes
Starting Member
7 Posts |
Posted - 2010-08-05 : 15:36:26
|
What i am asking is how to execute GRANT SELECT ON TableName TO [Domain\UserName]from a ASP.net page (Not from the SQL Server Management Studio) |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
hemaljoes
Starting Member
7 Posts |
Posted - 2010-08-05 : 15:45:00
|
ExplanationI want to execute GRANT SELECT ON TableName TO [Domain\UserName] from ASP.net pagein the ASP.net i create SqlConnection and a SqlCommand in SqlCommand's commandText i want to give the query i want to execute.How could i give the [Domain\UserName]. Since [Domain\UserName] is a sysname object. How can i make sysname object from a string such as 'Domain\UsernName' or is there any other way that i can accomplish my task |
|
|
hemaljoes
Starting Member
7 Posts |
Posted - 2010-08-06 : 02:55:08
|
Sorry I think i haven't explain my problem clearlyHere what i need to doI can successfully execute the following command from a ASP pagesqlCommand.CommandText = "CREATE LOGIN [DomainName\\UserName] FROM WINDOWS";sqlCommand.ExecuteNonQuery();But i want to execute something like belowsqlCommand.CommandText = "CREATE LOGIN ["+txtNewUser.Text+"] FROM WINDOWS";sqlCommand.ExecuteNonQuery();Thanks in advanced |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
X002548
Not Just a Number
15586 Posts |
Posted - 2010-08-06 : 13:18:51
|
quote: Originally posted by hemaljoes What i am asking is how to execute....from a ASP.net page (Not from the SQL Server Management Studio)
Why don't you think that this is not an extremely bad idea?If you are trying to do grants from within an application, I'M SURE you are trying to create objects as well...you need to separate the duties...and if your "app" is buil;t this way, then you are trying to build a silver bulletNever have seen one workBrett8-)Hint: Want your questions answered fast? Follow the direction in this linkhttp://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspxAdd yourself!http://www.frappr.com/sqlteam |
|
|
|