<%@ Page Language="C#" Debug="true" %> <html> <head> <title>ThaiCreate.Com ASP.NET - AccessDataSource</title> </head> <body> <form id="form1" runat="server"> <asp:GridView id="myGridView" runat="server" AutoGenerateColumns="False" DataKeyNames="CustomerID" DataSourceid="myDSource" AllowSorting="True" AutoGenerateEditButton="true" AutoGenerateDeleteButton="true"> <Columns> <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> <asp:AccessDataSource id="myDSource" runat="server" DataFile="~/database/mydatabase.mdb" SelectCommand="SELECT * FROM [customer]" UpdateCommand="UPDATE [customer] SET [Name] = @Name, [Email] = @Email, [CountryCode] = @CountryCode, [Budget] = @Budget, [Used] = @Used WHERE [CustomerID] = @CustomerID" DeleteCommand="DELETE FROM [customer] WHERE [CustomerID] = @CustomerID"> </asp:AccessDataSource> </form> </body> </html>
ช่วยกันสนับสนุนรักษาเว็บไซต์ความรู้แห่งนี้ไว้ด้วยการสนับสนุน Source Code 2.0 ของทีมงานไทยครีเอท