Since some of my beloved friend facing some issues on installing SQL Server Express and Studio viewer for their Visual Studio 2008 or 2010, here is some tidbits for you guys. Specially made for you.
Note: I assume you already install Visual Studio 2008 or 2010. And since I did this at Windows Server 2008 R2, some step may not relevant if you install it on Windows 7. Well, without further ado… let get started, shall we.
First, download SQL Express 2008 at : http://www.microsoft.com/downloads/details.aspx?FamilyId=7522A683-4CB2-454E-B908-E805E9BD4E28&displaylang=en#filelist
Choose SQLEXPRWT_x86_ENU.exe if your operating system is 32 bit OS such as Windows 7 x86. Else, use SQLEXPRWT_x64_ENU.exe. If you are not sure, use x86 instead, since x64 will not work in 32 bit operating system.
Then, once the file is successfully downloaded, double click on it to install it. (As I try to install this at Windows Server 2008 R2, I got this message below).
So, just click OK. Give it half a minute to enable .NET framework Core role and a new windows will pop up.
Click on “New installation or add features to an existing installation”
Click on “I accept the license terms” and click Next button.
Ouchy…have to click on OK button..no matter what…so click it. Don’t worry, your computer will not automatically restart just like that… a new window will popup as below.
Click on every checkbox and proceed with Next button.
At this stage, type in an instance name. It could be anything. However, it is wiser to put a name that makes you easy to recognize it later on. For my case, I put pena_sql08expr which mean, this database is used for my PENA project, and it use SQL Server 2008 Express. Click next to proceed…
Set “SQL Server Browser” to Manual. It will not automatically run at your windows start-up but it will be there if your program or you happen to need it later on. Click Next button to proceed.
I prefer to have both kind of authentication which is my Windows username credential and SQL server authentication. If you choose this step, type your SQL password in both textbox. And please, don’t forget this password. For more information regarding this thing, please refer: http://msdn.microsoft.com/en-us/library/ms144284.aspx. This is a matter of security preference.
Proceed with Next button. You are not required to tick the send windows and sql server error report to Microsoft. I tick it for the sake of better product development in the future.
Tick tock tick tock. Give it couple of minutes to complete this installation process.
OK, installation done. It reminds me for the second time to restart… Click on OK button and a new window (as shown in picture below) will appear.
Proceed with Close button.
OK, after your PC is restarted, it is time to open up Microsoft SQL Server Management Studio. This is the tool that allows you to create table, manipulate query etc. Something like Navicat (MySQL) or SQLDeveloper (Oracle). For PHP user, perhaps this is something like MyPHPAdmin.
At Start Menu, type “SQL Management” and click at SQL Management Studio icon.
Click Cancel.
For Server name, type: .\“Your SQL Instance Name”. As for my case, it is .\PENA_SQL08EXPR
Alternatively, you may also type .\SQLEXPRESS (not recommend)
All right guys, here is your MSSMS (Microsoft SQL Server Management Studio). You may create new database, create new table, perform query etc…
Let say, we want to create a new table, name “Account”.
Right click on Database icon, and choose “New Database”.
Type a name for your database. As for myself, I name it as PENA. Click OK to proceed.
Expand Database à PENA (or your database name) à Tables à RIGHT CLICK à New Table
This will create a new table for PENA database.
For this table, I would like to make the “id” as the primary key and it has to have auto increment features. So, Uncheck allow nulls, right click on it and choose Primary Key. In column property, ensure Identify Specification set to Yes. Then, click on save button or CTRL + S. Now, a new table name “Account” is created under Databases/PENA/Tables/Account.
If you would like to edit or enter new data in it (via GUI), right click on dbo.Account and choose “Edit top 200”. A new windows will show as below.
(Note: In real practice, you should hash or SHA the password, so even someone open up database’s table like this, it can’t see users’ password.”
If you would like to view the content of this table, right click on the table and choose “Select Top 1000 Rows”.
Otherwise, we use the good old SQL Query by pressing CTRL + N (or File à New à Query with current connection), a new windows as screenshot below will be displayed…
For this query, I type SELECT * from Account;
And proceed by clicking Execute button…and viola… the results are there…
Ok cool… at this stage, your SQL Server is properly configured, a new database has been created, and also a new table has been created as well. In other word, your SQL Server DB work just fine and waiting to be manipulated by you from Visual Studio.
Do not close your Microsoft SQL Server Management Studio yet (if you happen to close it already, open it up and enter re-connect the database).
Open your Visual Studio, and create a new application (doesn’t matter, rich client form or web based”. From the menu bar, select Data à Add New Data Source
Choose Database and click Next button.
Choose Dataset and proceed with Next button.
Click on New Connection button.
Choose Microsoft SQL Server and click Continue button..
For Server name, type: .\“Your SQL Instance Name”. As for my case, it is .\PENA_SQL08EXPR
(Note: If “.\” doesn’t does the trick, replace it with your computer name + \. For my case, “arhamwinsvr08r2\” )
Then, you can select your newly created database from drop down list at Select or enter a database name. As for my case, I have to choose PENA.
Click on Test Connection to check if everything allright.
Nice..everything work just fine. Click OK and OK.
Now, a new data connection is listed. Click Next button to proceed.
Save this connection string. I customize it as PENAConnectionString. It just a name for this connection string. It could be anything actually.
Tick elements that you want to include in this dataset and name your new dataset and click finish.
Now, you can cross check with Server Explorer and Data Sources window:
Drag your Account (from PENADataSet) to your forms and see what happen… and you may press F5 to view the output…
You may your datagrid to whatever format you want as well..
So guys, I will stop here (for this moment), happy exploring and FYPing..
If you guys has any information which you would like to share, please, feel free to do so (comment box).