About Me

My photo
Hello, I'm a technology geek looking to upgrade my programming skills. These are some of the things I'm learning along my journey.

Wednesday, July 4, 2012

Create a SQL Server Database in Visual C#

Create a new project in Visual C#. Select Windows Forms Application in the New Project dialog box and enter a project name. Click "OK".


In the "Database Explorer" right click on "Data Connections" and choose "Add Connection...".


Click on "Change..." and select "Microsoft SQL Database File(SqlClient)" in the "Add Connection" dialog box. Fill in a new database name in the text box below. Make sure "Use Windows Authentication" is selected and click "OK".


Click "Yes" in the popup window.

Your new SQL Server database should be visible in the "Database Explorer". Expand the selection by clicking on the triangle to the left of the new database file.


Right click on the "Tables" folder and select "Add New Table".


Fill in some test columns in the entry grid and click save.


Choose a table name and click "OK".


Expand the "Tables" folder by clicking on the triangle to the left and verify that the new table has been created.


Right click on the new table name and select "Show Table Data".


Enter some test data in each row.



No comments:

Post a Comment