Easy Tutorial
❮ Prop Webcontrol Tablerow Verticalalign Prop Webcontrol Listbox Selectionmode ❯

WebSecurity - InitializeDatabaseConnection()



Definition

The InitializeDatabaseConnection() method initializes the WebSecurity database.

This method initializes the WebSecurity system by connecting to a database that contains user and membership information.


C# and VB Syntax


Parameters

Parameter Type Description
connectionString String The name of your WebSecurity database
userTableName String The database table containing user profile information
userIdColumn String The database column containing the user ID (primary key)
userNameColumn String The database column containing the user name
autoCreateTables Boolean true indicates that the user profile and membership tables must be created if they do not exist; otherwise, false

Return Value

None.


Remarks

If using SQL Server Compact, ** should be the name of the WebSecurity database (without the .sdf file extension). Otherwise, it should be the name of the connection string in the web configuration (web.config file).

| | Even if autoCreateTables forces the database tables to be automatically created, the database itself must already exist. | | --- | --- |


Errors and Exceptions

The InitializeDatabaseConnection() method throws an InvalidOperationException in the following cases:


Technical Data

Name Value
Namespace WebMatrix.WebData
Assembly WebMatrix.WebData.dll

❮ Prop Webcontrol Tablerow Verticalalign Prop Webcontrol Listbox Selectionmode ❯