Register Register Member Login Member Login Member Login Forgot Password ??
PHP , ASP , ASP.NET, VB.NET, C#, Java , jQuery , Android , iOS , Windows Phone
 

Registered : 109,027

HOME > ASP.NET > ASP.NET Data Control > ASP.NET EntityDataSource - asp:EntityDataSource



Clound SSD Virtual Server

ASP.NET EntityDataSource - asp:EntityDataSource

ASP.NET EntityDataSource - asp:EntityDataSource เป็น Control ในกลุ่มของ DataControl ที่ใช้สำหรับการสร้าง Entity DataSource เพื่อเรียกใช้งาน Entity Data Model

Framework : 3,4


ASP.NET EntityDataSource

*** บทความนี้ไม่สมบูรณ์


Syntax

<asp:EntityDataSource ID="myEntityDataSource" runat="server"></asp:EntityDataSource>



ASP.NET EntityDataSource

เริ่มจากการสร้าง ASP.NET Entity Data Model โดลคลิกควาที่ Project เลือก Add New Item


ASP.NET EntityDataSource

เลือก ASP.NET Entity Data Model


ASP.NET EntityDataSource

เลือก Yes เพื่อเก็บ Code ไว้ใน App_Code

ASP.NET EntityDataSource

เลือก Generate from database

ASP.NET EntityDataSource

เลือก New Connection








ASP.NET EntityDataSource

เลือก Microsoft SQL Server

ASP.NET EntityDataSource

กำหนด Connection ของ SQL Server

ASP.NET EntityDataSource

เลือก Connection ที่ได้จากการสร้าง

ASP.NET EntityDataSource

เลือก Table

ASP.NET EntityDataSource

ได้ object ชื่อ customer ดังรูป

ASP.NET EntityDataSource

ลาก EntityDataSource มาไว้ใน Web Form เลือก Configure Data Source

ASP.NET EntityDataSource

เลือก Connection ของ Entities


ASP.NET EntityDataSource

เลือกรูปแบบการอ่านข้อมูลจากตาราง

ASP.NET EntityDataSource

ทดสอบกับ Control ของ GridView

ASP.NET EntityDataSource

ได้ผลลัพธ์เหมือนกับในรูป

สำหรับตัวอย่างนี้สามารถใช้ได้ทั้ง VB.NET และ C#

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="EntityDataSource.aspx.vb" Inherits="EntityDataSource" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>ThaiCreate.Com Tutorial</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    
        <asp:EntityDataSource ID="EntityDataSource1" runat="server" 
            ConnectionString="name=mydatabaseEntities" 
            DefaultContainerName="mydatabaseEntities" EnableDelete="True" 
            EnableFlattening="False" EnableInsert="True" EnableUpdate="True" 
            EntitySetName="customers">
        </asp:EntityDataSource>
        <asp:GridView ID="GridView1" runat="server" AllowPaging="True" 
            AllowSorting="True" AutoGenerateColumns="False" DataKeyNames="CustomerID" 
            DataSourceID="EntityDataSource1">
            <Columns>
                <asp:CommandField ShowDeleteButton="True" ShowEditButton="True" 
                    ShowSelectButton="True" />
                <asp:BoundField DataField="CustomerID" HeaderText="CustomerID" ReadOnly="True" 
                    SortExpression="CustomerID" />
                <asp:BoundField DataField="Name" HeaderText="Name" SortExpression="Name" />
                <asp:BoundField DataField="Email" HeaderText="Email" SortExpression="Email" />
                <asp:BoundField DataField="CountryCode" HeaderText="CountryCode" 
                    SortExpression="CountryCode" />
                <asp:BoundField DataField="Budget" HeaderText="Budget" 
                    SortExpression="Budget" />
                <asp:BoundField DataField="Used" HeaderText="Used" SortExpression="Used" />
            </Columns>
        </asp:GridView>
    
    </div>
    </form>
</body>
</html>









Declarative Syntax
<asp:EntityDataSource
    AutoGenerateOrderByClause="True|False"
    AutoGenerateWhereClause="True|False"
    AutoPage="True|False"
    AutoSort="True|False"
    CommandText="string"
    ConnectionString="string"
    ContextType="typed ObjectContext"
    ContextTypeName="string"
    DefaultContainerName="string"
    EnableDelete="True|False"
    EnableInsert="True|False"
    EnableUpdate="True|False"
    EnableViewState="True|False"
    EntitySetName="string"
    EntityTypeFilter="string"
    GroupBy="string"
    Include="string"
    OnContextCreated="ContextCreated event handler"
    OnContextCreating="ContextCreating event handler"
    OnContextDisposing="ContextDisposing event handler"
    OnDataBinding="DataBinding event handler"
    OnDeleted="Deleted event handler"
    OnDeleting="Deleting event handler"
    OnException="IDynamicDataSource.Exception event handler"
    OnInserted="Inserted event handler"
    OnInserting="Inserting event handler"
    OnSelected="Selected event handler"
    OnSelecting="Selecting event handler"
    OnUpdated="Updated event handler"
    OnUpdating="Updating event handler"
    OrderBy="string"
    runat="server"
    Select="string"
    StoreOriginalValuesInViewState="True|False"
    Where="string"
>
        <CommandParameters />
        <DeleteParameters />
        <GroupByParameters />
        <InsertParameters />
        <OrderByParameters />
        <SelectParameters />
        <UpdateParameters />
        <WhereParameters />
</asp:EntityDataSource>


   
Share


ช่วยกันสนับสนุนรักษาเว็บไซต์ความรู้แห่งนี้ไว้ด้วยการสนับสนุน Source Code 2.0 ของทีมงานไทยครีเอท


ลองใช้ค้นหาข้อมูล


   


Bookmark.   
       
  By : ThaiCreate.Com Team (บทความเป็นลิขสิทธิ์ของเว็บไทยครีเอทห้ามนำเผยแพร่ ณ เว็บไซต์อื่น ๆ)
  Score Rating :  
  Create/Update Date : 2010-07-04 22:33:29 / 2017-03-28 21:56:19
  Download : Download  ASP.NET EntityDataSource - asp:EntityDataSource
 Sponsored Links / Related

 
ASP.NET Data Control
Rating :

 
ASP.NET SqlDataSource - asp:SqlDataSource
Rating :

 
ASP.NET AccessDataSource - asp:AccessDataSource
Rating :

 
ASP.NET ObjectDataSource - asp:ObjectDataSource
Rating :

 
ASP.NET XmlDataSource - asp:XmlDataSource
Rating :

 
ASP.NET SiteMapDataSource - asp:SiteMapDataSource
Rating :

 
ASP.NET ReportViewer - rsweb:ReportViewer
Rating :

 
ASP.NET DataPager - asp:DataPager
Rating :

 
ASP.NET LinqDataSource - asp:LinqDataSource
Rating :

 
ASP.NET Chart - asp:Chart
Rating :

 
ASP.NET QueryExtender - asp:QueryExtender
Rating :


ThaiCreate.Com Forum


Comunity Forum Free Web Script
Jobs Freelance Free Uploads
Free Web Hosting Free Tools

สอน PHP ผ่าน Youtube ฟรี
สอน Android การเขียนโปรแกรม Android
สอน Windows Phone การเขียนโปรแกรม Windows Phone 7 และ 8
สอน iOS การเขียนโปรแกรม iPhone, iPad
สอน Java การเขียนโปรแกรม ภาษา Java
สอน Java GUI การเขียนโปรแกรม ภาษา Java GUI
สอน JSP การเขียนโปรแกรม ภาษา Java
สอน jQuery การเขียนโปรแกรม ภาษา jQuery
สอน .Net การเขียนโปรแกรม ภาษา .Net
Free Tutorial
สอน Google Maps Api
สอน Windows Service
สอน Entity Framework
สอน Android
สอน Java เขียน Java
Java GUI Swing
สอน JSP (Web App)
iOS (iPhone,iPad)
Windows Phone
Windows Azure
Windows Store
Laravel Framework
Yii PHP Framework
สอน jQuery
สอน jQuery กับ Ajax
สอน PHP OOP (Vdo)
Ajax Tutorials
SQL Tutorials
สอน SQL (Part 2)
JavaScript Tutorial
Javascript Tips
VBScript Tutorial
VBScript Validation
Microsoft Access
MySQL Tutorials
-- Stored Procedure
MariaDB Database
SQL Server Tutorial
SQL Server 2005
SQL Server 2008
SQL Server 2012
-- Stored Procedure
Oracle Database
-- Stored Procedure
SVN (Subversion)
แนวทางการทำ SEO
ปรับแต่งเว็บให้โหลดเร็ว


Hit Link
   







Load balance : Server 03
ThaiCreate.Com Logo
© www.ThaiCreate.Com. 2003-2024 All Rights Reserved.
ไทยครีเอทบริการ จัดทำดูแลแก้ไข Web Application ทุกรูปแบบ (PHP, .Net Application, VB.Net, C#)
[Conditions Privacy Statement] ติดต่อโฆษณา 081-987-6107 อัตราราคา คลิกที่นี่