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
 SQL Server 2000 Forums
 SQL Server Development (2000)
 SQL Server Logins/Roles and VB

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2001-12-11 : 09:44:26
Simon Gough writes "Hi Just wondering....

I am developing a system in VB and SQL Server 7.

I have a bunch of users in my SQL DB and they have roles. I can connect to the database ok by setting up a connection string via what the user entered for their username, password and DSN.

What I need to know is this:
Is there an easy way of creating new users (in the SQL Server Logins), assigning them a role and then reading this role whenever a user logs into my system so that I can set up the front end to suit their particular role????

If I did say have some kind of stored procedure to create a user, how could I pull the role names from the DB to populate a drop-down on the front end in the 'New User' form??


Or am i better off just having some kind of a standard connection string (what would this be?) and processing users/user levels via tables in my database?



Thanks for any help. This is driving me slowly mad!

Simon Gough"

squisher
Starting Member

6 Posts

Posted - 2001-12-11 : 10:28:12
I found theese in books-online:

sp_addlogin (T-SQL)
Creates a new Microsoft® SQL Server™ login that allows a user to connect to a server running SQL Server using SQL Server Authentication.

Syntax
sp_addlogin [@loginame =] 'login'
[,[@passwd =] 'password']
[,[@defdb =] 'database']
[,[@deflanguage =] 'language']
[,[@sid =] 'sid']
[,[@encryptopt =] 'encryption_option']


sp_addrolemember (T-SQL)
Adds a security account as a member of an existing Microsoft® SQL Server™ database role in the current database.

Syntax
sp_addrolemember [@rolename =] 'role',
[@membername =] 'security_account'


just execute sp_addlogin and then sp_addrolemember(make sure you got the rights to do it)

-Stefan-

Go to Top of Page
   

- Advertisement -