Abstract
This article i will describe you to migrate your application from 2-Tier architecture to the most advance Data Access methodology available in .Net 4.0.Please keep watching all migration articles one by one. If it really helps you out then please don't forget to put your feedback and comments.
2 Tier Architecture
If you are writing all the data access logic inside your code behind, I guess your code looks like this.
- While Inserting Data into Database:
SqlConnection sqlConnection = new SqlConnection(ConfigurationManager.ConnectionStrings["EmployeeConString"].ConnectionString);
SqlCommand sqlCommand = new SqlCommand(string.Format("INSERT INTO Department (DepartmentId, Name, Budget, StartDate) VALUES ({0}, '{1}', {2}, '{3}')", txtDeptId.Text, txtDeptName.Text, txtBudget.Text, txtStartDate.Text), sqlConnection);