SQL Server Database Connectivity issues

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

Unable to open the requested database in login ' Patdb '. Login failed.

User ' xp-201005191456\huting ' login failed.

Problems encountered and solutions

1.vs2010 Connect sqlserver2008 Prompt to open the requested database in the login ' Patdb '. Login failed. User ' xp-201005191456\huting ' login failed.

---->

VS2010 Server Explorer-data connection----ADD Link---Server name select xp-201005191456\sqlexpress---Windows Province authentication---Connect to a database---test connection, Show successful Connection---"OK, you can

2. Right-click on the connected database on the Server Explorer, point properties. See the connection string

Data source=xp-201005191456\sqlexpress;initial catalog=patdb;integrated Security=true

Copy the above connection string into the VS2010 connection string---string connstring= "Data source=xp-201005191456\sqlexpress;initial catalog=patdb;i ntegrated security=true ";

Prompt error

\SQLExpress, indicating an unrecognized escape sequence

Workaround: String [email protected] "Data source=xp-201005191456\sqlexpress;initial catalog=patdb;integrated security=true "

Connection Database Successful

3 in the SQL SERVER table, insert a new field

ALTER TABLE doc_exa ADD column_b VARCHAR () NULL

Doc_exa is the table name

Column_b is the newly added field

VARCHAR (20) is the type and length of the newly added field

ALTER TABLE pat_info ADD Pet class VARCHAR (+) NULL

SELECT * FROM Pat_info

4 The field order of the SQL Server 2008 data table is adjusted after you save the prompt error

Start SQL Server Management Studio

The Tools menu----options----Designers (designer)----prevent saving changes that require you to recreate the table uncheck the box.

5 SQL How to insert data

Insert Intopat_info (number, pet category, name, origin, age, fur color, price, place of trade, notes) VALUES (5, ' dog ', ' Tibetan mastiff ', ' Inner Mongolia ', 4, ' white ', 4000, ' Beijing ', ' Hero Dog ')

Insertinto Table name (Field 1, Field 2, Field 3) values (the value of field 1, the value of field 2, the value of field 3);

SQL Server 2008 also extends the INSERT into syntax, allowing multiple rows to be inserted at once. As follows:
Insert into table name (Field 1, Field 2, Field 3)
Values (the value of field 1 is 1, the value of field 2 is 1, the value of field 3 is 1), (the value of field 1 is 2, the value of field 2 is 2, and the value of field 3 is 2),...

6 Pat Field

and query fields: 1-Pet Category 2-Origin 3-trade place 4--age 5--fur Color

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.