Creating a data access layer in C# .NET.
Basic items making up a typical data access layer. This layer connects the business layer to the database.
public string connString = @"Data Source=localhost; Initial Catalog = Database; User Id=sa; Password=";
using System;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Collections.Generic;
using System.Text;
using System.Security.Cryptography;
using System.IO;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Collections.Generic;
using System.Text;
using System.Security.Cryptography;
using System.IO;
private int userID;
private decimal cost;
private string orderCreateDate;
private decimal cost;
private string orderCreateDate;
public int UserID
{
public decimal Cost
{
public string OrderCreateDate
{
{
get { return userID; }
set { userID = value; }
}set { userID = value; }
public decimal Cost
{
get { return cost; }
set { cost = value; }
}set { cost = value; }
public string OrderCreateDate
{
get { return orderCreateDate; }
set { orderCreateDate = value; }
}
set { orderCreateDate = value; }
public void InitializeVariables()
{
{
this.cost = 0;
this.isActive = 0;
this.createDate = "";
}this.isActive = 0;
this.createDate = "";
Data Access Layer Part 2 : Constructor and Public Functions
Data Access Layer Part 3 : Stored Procedures