ADO Net Database ASP.Net Tutorial

<%@ Page Language="C#" AutoEventWireup="true"%>
<%@ Import Namespace="System.Text" %>

  void deptSource_Selected(Object sender, System.Web.UI.WebControls.SqlDataSourceStatusEventArgs e)  
  {
      StringBuilder builder = new StringBuilder();
      foreach (System.Data.SqlClient.SqlParameter param in e.Command.Parameters)
      {
          builder.Append(Server.HtmlEncode(param.ParameterName) + "=");
          builder.Append(Server.HtmlEncode(param.Value.ToString()) + " (");
          builder.Append(Server.HtmlEncode(param.Value.GetType().ToString()) + ")
");
      }
      lblResult.Text = "Return Parameter : " + builder.ToString();
  }


  
    Handling Return Parameters from a Stored Procedure
  
  
    
              DataSourceID="deptSource" DataKeyNames="DepartmentID"
        AutoGenerateColumns="False" HeaderStyle-HorizontalAlign="Center" HeaderStyle-Font-Bold="True"
        HeaderStyle-BackColor="blue" HeaderStyle-ForeColor="White">
        
          
          
          
          
        

      
              SelectCommand="GetDepartments"        
        ConnectionString="<%$ ConnectionStrings:AdventureWorks%>" OnSelected="deptSource_Selected">