Mega Code Archive
DataAdapter is the bridge between an in-memory table and a physical table
File: App_Code\Product.cs
using System;
using System.Data;
using System.Data.SqlClient;
using System.Web.Configuration;
using System.Collections.Generic;
public class Product
{
private static readonly string _connectionString;
public DataTable GetAll()
{
SqlDataAdapter dad = new SqlDataAdapter("SELECT Title,Director FROM Products", _connectionString);
DataTable dtblProducts = new DataTable();
dad.Fill(dtblProducts);
return dtblProducts;
}
static Product()
{
_connectionString = WebConfigurationManager.ConnectionStrings["Products"].ConnectionString;
}
}
File: Web.config
File: ShowProduct.aspx
<%@ Page Language="C#" %>
Show Product