I am a Java and Open Source fan but I have to accept that Microsoft has made developing rich web applications very easy by bringing in .Net technology. Using C#/ASP.Net you can develop and deploy your application much faster. The comprehensive official Microsoft development documentation and developer forums (MSDN) further simplify your task.
Step 1: Download and Install Required Software/Tools
- Microsoft Visual Studio 2003 or Microsoft Visual Studio 2005 (2003 is an old version so likely to give you trouble)
- Microsoft SQL 2005 Server Express (Free Download)
- Microsoft SQL Server Management Studio Express (Free Download)
- Microsoft Visual Studio 2005 Express
Step 2: Create Web Application Project
Create a new Web Application type project using Visual Studio 2005.
Step 3: Create Database
- Right click your newly created project
- Select Add New Item
- Select SQL Database
- Enter the name of the database you want to create
- It will prompt you to create App_Data folder in your project if it doesn't already exist. Select Ok.
- Above step will create an empty database
Step 4: Create Database Tables
- Navigate to your database Tables directory in the solution database explorer
- Right click, and Add New Table
- Enter a name to your database table
- Add Table Column Names, Types, and add comments
Step 5: Connect to Database
You may directly bind a database/table to a page or screen. Or you could access it from a class. For having a class connect to a database you can do:
string connexnString = "Data Source=DB-NAME;AttachDbFilename=mydb.mdf;Integrated Security=True;User Instance=True";SqlConnection connection = new SqlConnection(connexnString )
You can then use the connection with SqlCommand.
Step 6: Build & Run
2236 days ago