Roy
Roy

Reputation: 2323

Add account to SQL Server in .net

Is there any API SQL Server 2008 offers for .net application to create and grant access authorities? Thanks!

Upvotes: 0

Views: 186

Answers (2)

Remus Rusanu
Remus Rusanu

Reputation: 294297

A .Net specific API for SQL administration is SMO. See Managing Users, Roles, and Logins. To create a new login you call the Login.Create method.

Upvotes: 1

mjv
mjv

Reputation: 75165

T-SQL has CREATE USER and other related commands which can be used to create user and/or to GRANT various privileges. This can be invoked directly from ADO.

This works for SQL accounts, if you are using the "integrated" security model, you'll need to add new accounts at the level of the OS / Active Directory.

Upvotes: 1

Related Questions