<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="IdentityFieldExample.aspx.cs" Inherits="Database.IdentityFieldExample" %>

 

<!DOCTYPE html>

 

<html xmlns="http://www.w3.org/1999/xhtml">

<head id="Head1" runat="server">

    <title>Identity Field Example</title>

</head>

<body bgcolor="#99ffcc">

 

    <h3>This example demonstrates adding a record to the database and retrieving the value of an Identity field that is handled by the database. This example uses a Stored Procedure to return the Identity field&#39;s value that was automatically created by the database. Retrieving the Identity field for a newly inserted record relies on a live database connection (session). The DBConnect class opens and closes the database connection as needed, so a Stored Procedure is required.

    </h3>

 

   <form id="form1" runat="server">

       

        <asp:Label ID="Label1" runat="server" Font-Bold="True"

            style="z-index: 1; left: 14px; top: 113px; position: absolute; bottom: 360px;"

            Text="Customer Name:"></asp:Label>

 

        <asp:TextBox ID="txtName" runat="server"

           

            style="z-index: 1; left: 138px; top: 114px; position: absolute; width: 170px; height: 20px;"></asp:TextBox>

 

        <asp:Label ID="lblDisplay" runat="server" Font-Bold="True"

            style="z-index: 1; left: 140px; top: 146px; position: absolute"></asp:Label>

              

        <asp:Button ID="btnAddCustomer" runat="server"

           

            style="z-index: 1; left: 333px; top: 114px; position: absolute; height: 27px; bottom: 351px; width: 190px;"

            Text="Add Customer Record" OnClick="btnAddCustomer_Click" />

              

        <br />

        <br />

        <br />

        <br />

        <br />

        <br />

              

    </form>

 

</body>

</html>