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 static function InitializeDatabaseConnection(
	connectionString : String, 
	providerName : String, 
	userTableName : String, 
	userIdColumn : String, 
	userNameColumn : String, 
	autoCreateTables : boolean


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.