How to read other people's source code project packages (ASP. NET + SQL Server)

Source: Internet
Author: User
Tags sql server management sql server management studio sql server express

As a newbie, I downloaded several ASP. NET source code packages from 51aspx to study and learn. However, a small problem occurs, that is, some packages cannot be properly previewed, because some of them have DB access, while some source packages do not have dB files, and some are attached with DB files, I still couldn't open it, so I tried several more times. Finally, we can see people's things normally.

 

First, if there is a source code project package, double-click the SLN file and open it with vs2008. If it is created with another version of Vs, the conversion is usually prompted, it doesn't matter, convert directly as prompted.

After opening the page, can I view it directly in a browser? If not, check whether something is worse. It is generally a DB connection problem. At this time, find one in the entire folder. MDF is usually put under the asp_data folder in a standard way. the MDF file also has one. LDF files are SQL server data files. This directly copies the DB data files as they are. Another backup method is to use the backup tools provided by the system, what we get at this time is. bak file. If the. MDF and. LDF files are available, you can open SQL Server Management studio. Then, right-click the database node, select "Attach", and specify. the MDF file location, if not. the LDF file seems to work normally, but the system will prompt whether to create it. LDF file, select "yes.

There is also a way to execute SQL import:

Exec sp_attach_db 'database name', 'mdf file Path'
For example, if your database name is firstborn and the MDF file path is D:/firstborn. MDF, you can use the followingCodeDone

Exec sp_attach_db 'firstborn', 'd:/irstborn. MDF

 

Then, find sqlconnection in the system. the location of the open () method. Check its connection string. What is it used? If it is plain text, change the connection string of local SQL Server express in the Code and set the logon method to sspi.

 

Now you can view the sample page again in browser. Next, we can study the specific part of others' code step by step.

 

Another problem is that some dB queries are stored procedures, which are actually part of the database and are not included in ASP. to view its content in the. NET project, go to SQL Server Management studio. The query method is as follows: Right-click the database name, create a new query, and run the following command:

Sp_helptext

Displays the text of rules, default values, unencrypted stored procedures, user-defined functions, triggers, or views.

Syntax

Sp_helptext[@ Objname =]'Name'

 

You can see the statement content of the stored procedure.

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: info-contact@alibabacloud.com 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.