Tutorial RSS
 
DB Tutorials Server Intellect Cloud Hosting
Navigator: Home - Retrieve - Creating a Basic Database Table in Visual Studio

Creating a Basic Database Table in Visual Studio

This is a simple introductory tutorial to build simple database tables with Microsoft visual studio 2010.

Creating a Basic Database Table in Visual Studio

 

Download the Basic Database Table Project Source

This tutorial is for beginners who are just starting out that are looking for a simple introductory tutorial to build simple database tables with Microsoft visual studio 2010.

 

Yes, it is possible to find a good web host. Sometimes it takes a while. After trying several, we went with Server Intellect and have been very happy. They are the most professional, customer service friendly and technically knowledgeable host we've found so far.  

                                    

1. In the solution explorer, right click on the name of the website.  Select Add new ASP.NET folder from the list and then select App Data folder.

-A new folder named App_Data will be created in the solution explorer.

2. Right click on the App_Data folder and select Add New Item from the list.  Select SQL Server Database from the list.

-You can name the database any name you want as long as it has the .mdf extension attached to it.

3. Click Add.

4. Once the database is created, select the Server Explorer tab (located at the bottom of the solution explorer window).

5. Under the Data connections folder, a database file with the name you gave it when you created it will appear on the list.  Click to expand the list and then right click on the table folder.  Select Add New Table from the list.

-For this tutorial we are going to create a mock customer database to establish some of the basic functions of adding properties to a database table. You can use this table for other database tutorials that where it is indicated.

6. For the first column we will create the customer ID.  Type the text CustomerID under the column name in the table. 

We are using Server Intellect and have found that by far, they are the most friendly, responsive, and knowledgeable support team we've ever dealt with! 

 

7. In the column to the right of the column name, select int from the dropdown list.

-This assigns an integer property to the first column in the table.

8. Uncheck the allow nulls box.

-Unchecking the Allow Nulls box requires the user to inter information in the column. In other words, the field cannot be left blank if the row is not set to allow null (empty) values.

9. We are going to create five more columns of data.

10. In the second row under customerID, type FirstName, select varchar(50) for the data type and uncheck the allow nulls box.

-Varchar is an abbreviation for variable character which is a single character of data such as a single letter or number.  The (50) represents the maximum amount of characters that can be entered into a given text field.

11. In the third row type LastName for the column name, give it a data type of varchar(50) and uncheck the allow nulls box.

12. In the fourth row type AccountStatus for the column name, give it a data type of varchar(50) and uncheck the allow nulls box.

13. In the fifth row type MemberSince for the column name, give it a data type of smalldatetime and uncheck the allow nulls box.

-SmallDateTime is a property where a date format is set.  For example mm/dd/yyyy is the set format for this property.

14. In the sixth row type Accountbalance for the column name, give it a data type of smallmoney and uncheck the allow nulls box.

-The smallmoney property displays a monetary value in the database and can only consist of numeric characters.

15. Select the first column of the first row (CustumerID) and the go to the column properties list (located under the table).  Scroll to Identity Specification and expand the list.  To the right of the (is identity) property set the value to Yes.

16. Right click in the CustomerID column where you typed the text and select Set Primary Key from the dropdown list.

-The image below is what the finished table should look like.




                  






 

 

 

17. Save the table and name it Customers.

-We now have a functional table database that we can use to display and retrieve data from.

 

Yes, it is possible to find a good web host. Sometimes it takes a while. After trying several, we went with Server Intellect and have been very happy. They are the most professional, customer service friendly and technically knowledgeable host we've found so far.