User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the MS SQL section within the Web Development category of DaniWeb, a massive community of 423,775 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,532 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our MS SQL advertiser: Programming Forums
Views: 1180 | Replies: 5 | Solved
Reply
Join Date: May 2007
Location: India
Posts: 494
Reputation: choudhuryshouvi is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 45
choudhuryshouvi's Avatar
choudhuryshouvi choudhuryshouvi is offline Offline
Posting Pro in Training

Question How to create SECURITY LOGIN from front-end coding

  #1  
Mar 10th, 2008
i have a database called "BILLING_SYSTEM" in sql server 7.0 and I'm using sql server authentication mode to connect to the database with my username "BS" and password "BS".

where my front-end is a VB6.0 application.

now I want to create this security login "BS/BS" from vb6.0 code without opening the enterprise manager console.

so how can I accomplish that?
or is there any T-SQL command for creating users?

any help on this would be highly appreciated. I have already searched in google for many time and nothing got yet. if somebody has any link to any related resources that becomes helpful too.

help plz...........its urgent...

regards
Shouvik
Last edited by choudhuryshouvi : Mar 10th, 2008 at 3:47 am.
Shouvik_The_Expert_Coder
Have a problem? Don't worry just give me a call and I'll fix it for you.
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Jan 2008
Location: Bangalore, India
Posts: 336
Reputation: DangerDev is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 32
DangerDev's Avatar
DangerDev DangerDev is offline Offline
Posting Whiz

Re: How to create SECURITY LOGIN from front-end coding

  #2  
Mar 10th, 2008
A computer lets you make more mistakes faster than any invention in human history - with the possible exceptions of handguns and tequila.
~Mitch Ratcliffe
Reply With Quote  
Join Date: May 2007
Location: India
Posts: 494
Reputation: choudhuryshouvi is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 45
choudhuryshouvi's Avatar
choudhuryshouvi choudhuryshouvi is offline Offline
Posting Pro in Training

Re: How to create SECURITY LOGIN from front-end coding

  #3  
Mar 10th, 2008
well this didn't work in sql server 7.0.
your linked article points me to sql server 2005 t-sqls which i donot require at this moment. i wish to do this job in 7.0 version. so, could you give me a sample code?
Shouvik_The_Expert_Coder
Have a problem? Don't worry just give me a call and I'll fix it for you.
Reply With Quote  
Join Date: May 2007
Location: India
Posts: 494
Reputation: choudhuryshouvi is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 45
choudhuryshouvi's Avatar
choudhuryshouvi choudhuryshouvi is offline Offline
Posting Pro in Training

Re: How to create SECURITY LOGIN from front-end coding

  #4  
Mar 16th, 2008
Ok i have figured this out.

thanks to the replied person and all who have paid visit to see this thread.

now this thread is closed.
bye.......
Shouvik_The_Expert_Coder
Have a problem? Don't worry just give me a call and I'll fix it for you.
Reply With Quote  
Join Date: Dec 2004
Location: London or Slovakia
Posts: 2,434
Reputation: peter_budo is a jewel in the rough peter_budo is a jewel in the rough peter_budo is a jewel in the rough peter_budo is a jewel in the rough 
Rep Power: 11
Solved Threads: 295
Moderator
Featured Poster
peter_budo's Avatar
peter_budo peter_budo is offline Offline
Code tags enforcer

Re: How to create SECURITY LOGIN from front-end coding

  #5  
Mar 17th, 2008
Would you mind to share your solution as other people can have similar problem too...
Learn to see in another's calamity the ills which you should avoid.
Publilius Syrus
(~100 BC)

If we helped you to solve your problem, answered your question please mark your post as SOLVED.
Reply With Quote  
Join Date: May 2007
Location: India
Posts: 494
Reputation: choudhuryshouvi is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 45
choudhuryshouvi's Avatar
choudhuryshouvi choudhuryshouvi is offline Offline
Posting Pro in Training

Re: How to create SECURITY LOGIN from front-end coding

  #6  
Apr 5th, 2008
Its been a pleasure to share my code here.
This is the code which I used in my application. Hope others will be benefited from this having same problem like me.

''this is for creating the user "BS" and associate it with the "BILLING_SYSTEM database
EXEC SP_ADDLOGIN 'BS','BS','BILLING_SYSTEM'
USE BILLING_SYSTEM
''these are for granting server roles
EXEC SP_ADDSRVROLEMEMBER 'BS', 'sysadmin'
EXEC SP_ADDSRVROLEMEMBER 'BS', 'securityadmin'
EXEC SP_ADDSRVROLEMEMBER 'BS', 'serveradmin'
EXEC SP_ADDSRVROLEMEMBER 'BS', 'setupadmin'
EXEC SP_ADDSRVROLEMEMBER 'BS', 'processadmin'
EXEC SP_ADDSRVROLEMEMBER 'BS', 'diskadmin'
EXEC SP_ADDSRVROLEMEMBER 'BS', 'dbcreator'
''these are for granting various database manipulation permissions
EXEC SP_ADDUSER 'BS','BS','public'
EXEC SP_ADDROLEMEMBER 'db_owner','BS'
EXEC SP_ADDROLEMEMBER 'db_accessadmin','BS'
EXEC SP_ADDROLEMEMBER 'db_securityadmin','BS'
EXEC SP_ADDROLEMEMBER 'db_ddladmin','BS'
EXEC SP_ADDROLEMEMBER 'db_backupoperator','BS'
EXEC SP_ADDROLEMEMBER 'db_datareader','BS'
EXEC SP_ADDROLEMEMBER 'db_datawriter','BS'
EXEC SP_ADDROLEMEMBER 'db_denydatareader','BS'
EXEC SP_ADDROLEMEMBER 'db_denydatawriter','BS'

Hope the above syntax will be acceptable and one more thing i must say this code is working like snapping knife in butter.

regards
Shouvik
Shouvik_The_Expert_Coder
Have a problem? Don't worry just give me a call and I'll fix it for you.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb MS SQL Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Other Threads in the MS SQL Forum

All times are GMT -4. The time now is 2:11 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC