Software Environment: WINDOWS7 (x64) + Visual Studio + SQL Server Express 2008
1. Configure the database
Install VS2010 accidentally brought the SQL Server Express also loaded, and later to use SQL Server 2008, tried n Many ways is not installed, Microsoft's things that makes people very uncomfortable. Re-install the system? No way! Is it not possible to bring your own Express version? So very small, if you can use later will not install a large and difficult to wait for the official version of SQL Server, online search, and really can ~ ~
A. Opening the SQL Server Configuration Manager, configuring the SQLExpress protocol
The following three protocols are to be enabled (note that the one without the callout 32 bit, because the 64-bit WINDOWS7 system)
Configure the "protocol" of TCP/IP properties: Listen all selected No
Configure the IP address of the TCP/IP properties: To be customized, the TCP port is 1433 (the default value can be modified according to the actual situation)
Note: The IP address in IP1-IP6 cannot be the same, otherwise the following SQL Sever service will not start
B. Configuring client Protocols
C. Restart the SQL Server service after configuration is complete
Note: If the service cannot be started, it can be resolved according to the error prompt or Event Viewer log analysis
Deliberately write the wrong IP address, do a test, the Almighty Event Viewer ~ ~
D. Test port: Cmd entered in the netstat-na command to view
Note: If no IP and port settings are present. Please check the previous procedure carefully, and also pay attention to shutting down the system firewall.
2. Using the database
A. Create A New Database
Suppose you create a database called school.
SQL Server authentication mode is disabled by default, using Windows Authentication Mode
The following can be created data table le, adding and removing errors, as your service~~
B. Adding a connection
B-1. Adding a SQL Server database connection
Log on using Windows Authentication Mode
You can see all the advanced properties of SQL Sever
Can't remember the database connection string? Properties tab Copy it directly, get it done! (also available in advanced properties)
You can also attach a database file to a database, even if an association occurs between SQL Server and the data file
B-2. Adding database file attachments to a local SQL Server instance
Similar to the "attaching a database file to a database" As mentioned above, the decal will no longer continue.
B-3. Adding an Oracle database connection by the way
For more information about the OracleClient namespace being deprecated: http://www.infoq.com/cn/news/2009/06/oracleclient_deprecated/
Adding other types of data connections is similar to the above mentioned, if there are encounters and configuration hassles, make the necessary additions later.
3. Upgrade Management Tools
Because Windows Authentication mode can only connect to a single database, multiple database switching is very uncomfortable, so to turn on the SQL Server authentication mode
A. Download administrative Tools SQL Server Management Studio Express, , more resources than imagined ~ ~
Since the installation of the own Express is X64, so also download X64 management tools, here in SQL Server R2 as an example
B. Installing administrative tools, enabling SA users
B-1. Open SQL Server Management Studio Enter in Windows Authentication mode
B-2. On server Properties--security, modified to mixed authentication mode
B-3. Security--Login-to-Properties, modify the password of the SA user
B-4. Restarting the SQL Server server
B-5. Log in again, this time using SQL Server authentication mode
Login successful with SA user
C. Use the command line to turn on SQL Server authentication mode, enable SA users
For detailed steps, please refer to: http://blog.csdn.net/neils03/article/details/6574841
sqlcmd Command Detailed: http://blog.csdn.net/siweioa/article/details/11300967
Finally: If the express is too troublesome to install the official version of SQL Server (in fact, I think Express is very good, small and light, commonly used), you must first install the SQL Server version of Visual Studio installed, or install the visual Do not install your own SQL Server Express in studio and then load SQL Server, so there is no problem, many people on the web say, I have not tried ...
Using the SQL Server Express that comes with Visual Studio