ADO Net Database ASP.Net Tutorial

<%@ Page Language="C#" %>
<%@ Import Namespace="System.Data.SqlClient" %>
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

    protected void srcProducts_Updating(object sender, SqlDataSourceCommandEventArgs e)
    {
        foreach (SqlParameter param in e.Command.Parameters)
        if (param.Value == null)
        {
            e.Cancel = true;
            lblError.Text = "All fields are required!";
        }
    }



    
    

            id="lblError"
        EnableViewState="false"
        CssClass="error"
        Runat="server" />
            id="dtlProduct"
        DataSourceID="srcProducts"
        DataKeyNames="Id"
        AllowPaging="true"
        AutoGenerateEditButton="true"
        Runat="server" />
            id="srcProducts"
        SelectCommand="SELECT * FROM Products"
        UpdateCommand="UPDATE Products SET Title=@Title,Director=@Director,DateReleased=@DateReleased WHERE Id=@id"
        ConnectionString="<%$ ConnectionStrings:Products %>"
        Runat="server" 
        OnUpdating="srcProducts_Updating" />
    

    


File: Web.config

  
             connectionString="Data Source=.\SQLEXPRESS;
         AttachDbFilename=|DataDirectory|MyDatabase.mdf;Integrated Security=True;User Instance=True" />