Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Execute GRANT query

Author  Topic 

hemaljoes
Starting Member

7 Posts

Posted - 2010-08-06 : 05:02:47
Hi,
I want to Execute a GRANT query from my ASP.net page.

I can successfully execute the following command from a ASP page

sqlCommand.CommandText = "CREATE LOGIN [DomainName\\UserName] FROM WINDOWS";
sqlCommand.ExecuteNonQuery();

But i want to execute something like below

sqlCommand.CommandText = "CREATE LOGIN ["+txtNewUser.Text+"] FROM WINDOWS";
sqlCommand.ExecuteNonQuery();

Thanks in advanced

kashyap_sql
Posting Yak Master

174 Posts

Posted - 2010-08-06 : 07:21:28
elaborate your need

With Regards
Kashyap M
Go to Top of Page

hemaljoes
Starting Member

7 Posts

Posted - 2010-08-06 : 07:31:21
I am making an ASP.net web application.

In this applications high previladge user can add new user.
For a example CEO can make new users.

Then CEO should be able to give permision to the user to access the database and there after for tables and SPs. This permision grant should be done from ASP.net page without going to SQL Server Managment studio and grant permission.

As the first step i am trying to make Login to the database from the ASP.net page.

Thanks.
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2010-08-06 : 13:29:52
quote:
Originally posted by hemaljoes

I am making an ASP.net web application.

In this applications high previladge user can add new user.
For a example CEO can make new users.

Then CEO should be able to give permision to the user to access the database and there after for tables and SPs. This permision grant should be done from ASP.net page without going to SQL Server Managment studio and grant permission.

As the first step i am trying to make Login to the database from the ASP.net page.

Thanks.



CROSS POST

You should create Roles...and in any case, your application should be creating Application Users in the database, not SQL Server users



Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

Add yourself!
http://www.frappr.com/sqlteam



Go to Top of Page
   

- Advertisement -