First create an ASP empty Web application
Right-click on the project to create a Aspnet folder after you've built it.
App_Data is used to store Mook Jong database files.
A database can be created in the newly created file.
There are two types of databases
One for the local database *.sdf is the server CE driver, this is the local database, but not complete.
One for SQL database *.mdf is the SQL Server database, which must be regenerated when uploading to the server.
Now I use MDF to create a name that is simply written as D.mdf, and then a database connection appears in Server Explorer, note that this is not a connection string.
Create a data table in the database, such as Table_user
Note how to add an AutoNumber to an ID:
The attribute in the right looks for the labeling specification
In the indicator specification Increment 1 increase seed start number like 0001
CREATE TABLE [dbo]. [Table_user]//table name
(
[UID] INT not NULL PRIMARY KEY IDENTITY,
[UserName] NCHAR (Ten) is not NULL,
[Userpass] NCHAR (Ten) is not NULL,
[UserEmail] NCHAR (Ten) is not NULL,
[Userregtime] DATETIME not NULL,
[Usernick] NCHAR (Ten) NULL
)
Then click on the above update, update the database, the data table is set up, and now on the database point right click on the refresh.
Provides a build link string for the database.
I often create a Web form, create a SqlDataSource1, and then click Configure Data source on the design mode,
Then choose the established database, according to the wizard to establish a string connection connectionstring, in fact, the default is good. Easy to call
About VS2012 How to connect to SQL database (text step)