How to: Create SQL Server Express Edition Databases
When you install Microsoft SQL Server 2005 Express Edition with Visual Web Developer, you can use the Visual Studio data-management tools to create SQL Server Express Edition databases and populate them with database elements, such as tables, data, stored procedures, views, and so on.
Creating a Database for a Web Application
To create a database
In Visual Web Developer, open Solution Explorer, right-click the App_Data folder of your Web application, and then click Add New Item.
If your application does not have an App_Data folder, right-click the root folder of your Web application, click Add ASP.NET Folder, and then click App_Data.
Click SQL Database, type a name for the .mdf database file, and then click Add.
Two files are created: DataBaseName.mdf and DataBaseName_log.ldf. Visual Web Developer automatically moves focus to the Data Connections section of the Server Explorer window and selects the newly created database.
To add a table to a database
In the Data Connections section of the Server Explorer window, double-click (or expand) the database to which you want to add a table.
Right-click the Tables folder and select Add New Table.
The focus moves to the table definition panel for a new table.
Add table columns, and specify the column name and data type of the new column, as well as whether the column allows nulls.
Select the primary-key column (or press SHIFT+SELECT to select multiple columns for a multi-column primary key), right-click the selection, and then click Set Primary Key.
Optionally, select an int (integer) column to specify as an identity column; and then, in the Column Properties panel for the column, double-click the Identity Specification section for the column and set (Is Identity) to Yes.
Press CTRL+S to supply a table name and save the table. If you close the table definition panel without saving the table, you will be prompted to supply a table name, and the table will be automatically saved.
To add data to a table in a database
In the Data Connections section of the Server Explorer window, double-click (or expand) the database that you want to work with and then double-click the Tables folder for that database.
Right-click the table to which you want to add data and then click Show Table Data.
In the data grid that appears, type the data that you want to place in the table, providing values for all of the required fields.
When you are finished, select the next new row of the data grid. Visual Web Developer now writes the values for the populated row to the table.