Add a User to an SQL Server

Category:
Database
Type:
Snippets
Difficulty:
Intermediate
Author:
Intelligent Solutions Inc.

Version Compatibility:

More information:
This function uses the ADO connection object to add a user to a SQL server and grant the user permissions to a database specified by one of the parameters. YOU MUST CHANGE THE FUNCTION TO SUPPLY YOUR OWN CONNECTION STRING, as explained by the code's comments.

Instructions: Copy the declarations and code below and paste directly into your VB project.

Declarations:

Code: