WebSecurity.InitializeDatabaseConnection Method (String, String, String, String, Boolean)

Initializes the membership system by connecting to a database that contains user information and optionally creates membership tables if they do not already exist.

Namespace:  WebMatrix.WebData
Assembly:  WebMatrix.WebData (in WebMatrix.WebData.dll)

Public Shared Sub InitializeDatabaseConnection ( _
	connectionStringName As String, _
	userTableName As String, _
	userIdColumn As String, _
	userNameColumn As String, _
	autoCreateTables As Boolean _
Dim connectionStringName As String
Dim userTableName As String
Dim userIdColumn As String
Dim userNameColumn As String
Dim autoCreateTables As Boolean

WebSecurity.InitializeDatabaseConnection(connectionStringName, _
	userTableName, userIdColumn, userNameColumn, _


Type: System.String
The name of the connection string for the database that contains user information. If you are using SQL Server Compact, this can be the name of the database file (.sdf file) without the .sdf file name extension.
Type: System.String
The name of the database table that contains the user profile information.
Type: System.String
The name of the database column that contains user IDs. This column must be typed as an integer (int).
Type: System.String
The name of the database column that contains user names. This column is used to match user profile data to membership account data.
Type: System.Boolean
true to indicate that user profile and membership tables should be created if they do not exist; false to indicate that tables should not be created automatically. Although the membership tables can be created automatically, the database itself must already exist.

For more information, see InitializeDatabaseConnection.

  • Medium trust for the immediate caller. This member can be used by partially trusted code.