ADO Net Database ASP.Net Tutorial

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" 
    Inherits="Default" %>



    Fill Load Options


    
        
            

                
                    
                        
                        
                        
                    
                    
                        
                        
                        
                    
                    
                        
                        
                        
                    
                
 ORIGINALCURRENT
BEFORE
                            
                        

                            
                        
AFTER
                            
                        

                            
                        

                
                
                    PreserveChanges
                    OverwriteChanges
                    Upsert
                
                
                
            

        
    



File: Default.aspx.cs
using System;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class Default : System.Web.UI.Page
{
  private DataSet _data;
  private string SelectCmd = "SELECT employeeid, firstname, lastname FROM employees";
  private void InitDataSet()
  {
    _data = new DataSet();    
    SqlDataAdapter adapter = new SqlDataAdapter(SelectCmd,ConfigurationManager.ConnectionStrings["NorthwindConnectionString"].ConnectionString);
    adapter.MissingSchemaAction = MissingSchemaAction.AddWithKey;
    adapter.Fill(_data);
    DataTable t = _data.Tables[0];
    DataRow r = t.Rows[0];
    r["firstname"] = "Michela";
    r.AcceptChanges();
    t = _data.Tables[0];
    r = t.Rows[0];
    r["firstname"] = "Sylvia";
  }
  protected void RefreshButton_Click(object sender, EventArgs e)
  {
    InitDataSet();
    DataRow row = _data.Tables[0].Rows[0];
    BeforeLoadOrig.Text = row["firstname", DataRowVersion.Original].ToString();
    BeforeLoadCurr.Text = row["firstname", DataRowVersion.Current].ToString();
    SqlDataAdapter adapter = new SqlDataAdapter(
      SelectCmd,
            ConfigurationManager.ConnectionStrings["NorthwindConnectionString"].ConnectionString);
    adapter.FillLoadOption = (LoadOption)Enum.Parse(typeof(LoadOption), LoadOptionList.SelectedValue);
    adapter.Fill(_data);
    AfterLoadOrig.Text = row["firstname", DataRowVersion.Original].ToString();
    AfterLoadCurr.Text = row["firstname", DataRowVersion.Current].ToString();
  }
  protected void LoadOptions_SelectedIndexChanged(object sender, EventArgs e)
  {
    AfterLoadOrig.Text = "";
    AfterLoadCurr.Text = "";
  }
}