MSDN Library

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

Initializes the membership system by connecting to a database that contains user information by using the specified membership or role provider, 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 ( _
	connectionString As String, _
	providerName As String, _
	userTableName As String, _
	userIdColumn As String, _
	userNameColumn As String, _
	autoCreateTables As Boolean _
Dim connectionString As String
Dim providerName As String
Dim userTableName As String
Dim userIdColumn As String
Dim userNameColumn As String
Dim autoCreateTables As Boolean

WebSecurity.InitializeDatabaseConnection(connectionString, _
	providerName, userTableName, userIdColumn, _
	userNameColumn, autoCreateTables)


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 ADO.NET data provider. If you want to use Microsoft SQL Server, the InitializeDatabaseConnection(String, String, String, String, Boolean) overload is recommended.
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 automatically; 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.
© 2016 Microsoft