Create an ASP. NET data storage layer (7)

Source: Internet
Author: User

Generate source code and installation script
Another important feature of Visual Studio. NET is that it can generate a complete script for an existing database. In fact, you can use Visual Studio. NET generates source code for the entire database layer (including generating tables and indexes, authorization, and stored procedures ), you can also generate a command line script that can be used to install these database objects on an existing SQL Server.
It is easy to generate the installation script, which involves two steps: first, you need to generate a T-SQL script to create database objects (tables, indexes, procedures, etc ). A command line script that executes the T-SQL script against the target SQL Server is then generated.
Generate T-SQL script
Before generating the installation script, you need to generate a script set, including creating all the objects (tables, indexes, constraints, users, etc.) in the database ).
Figure 11: generate a script set
Follow these steps to generate a T-SQL script:
In Server Explorer (Server resource manager), right-click the selected database node (DotNetKB), and select Generate Create Script from the context menu... (generate the creation script ...), open the Generate Create Scripts dialog box.
On the General tab, select the Script all objects (write all object scripts) check box.
On the Formatting tab, select all check boxes except the last one (only compatible with version 7.0 scripts ). The last item is required only when your target Server is SQL Server 7.0 instead of SQL Server 2000.
On the Options tab, in the Security Scripting Options section, select all Options except Script SQL Server logins (write SQL Server login Script. Make sure that all check boxes in the Table Scripting Options section are selected. Retain the default single button for both File Format and Files to Generate. Finally, when all the settings are set correctly, click OK to start the script generation process.
The system prompts you to specify the file location. By default, Visual Studio. NET directs to the Create Scripts (Create script) folder in the existing database project. Click OK to accept the default location.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.