首页 / 软件开发 / LINQ / LINQ to SQL之面向对象的添加、查询、更新和删除
        
            LINQ to SQL之面向对象的添加、查询、更新和删除2010-12-04 博客园 webabcd介绍以Northwind为示例数据库,DLINQ(LINQ to SQL)之完全面向对象的添加操作、查询操作、更新操作和删除操作示例Sample.aspx
<%@ Page Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile=
    "Sample.aspx.cs"
   Inherits="LINQ_DLINQ_Sample" Title="面向对象的添加、查 询、更新和删除" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
  <p>
    分类名称 :<asp:TextBox ID="txtCategoryName" runat="server"></asp:TextBox>
      分类 描述:<asp:TextBox ID="txtDescription" runat="server"></asp:TextBox>
     <asp:Button ID="btnAdd" runat="server" Text="添加" OnClick="btnAdd_Click" />
   </p>
  <asp:GridView ID="gvCategory" runat="server" DataKeyNames="CategoryID"
         OnSelectedIndexChanged="gvCategory_SelectedIndexChanged"     OnRowDeleting="gvCategory_RowDeleting" OnRowCancelingEdit="gvCategory_RowCancelingEdit"
     OnRowEditing="gvCategory_RowEditing" OnRowUpdating="gvCategory_RowUpdating">
     <Columns>
      <asp:CommandField ShowSelectButton="True" ShowEditButton="True"
          ShowDeleteButton="True">
       </asp:CommandField>
    </Columns>
   </asp:GridView>
  <br />
   <asp:DetailsView ID="dvProduct" runat="server" DataKeyNames="ProductID">
   </asp:DetailsView>
</asp:Content>