<?xml version="1.0"?><configuration> <connectionStrings> <add name="ConnectionString" connectionString="Data Source=localhost;Initial Catalog=mydatabase;UID=sa;PWD=" providerName="System.Data.SqlClient" /> </connectionStrings> </configuration>
<%@ Page Language="VB" %> <html> <head> <title>ThaiCreate.Com ASP.NET - SqlDataSource</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:SqlDataSource id="myDSource" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>" 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:SqlDataSource> </form> </body> </html>
ช่วยกันสนับสนุนรักษาเว็บไซต์ความรู้แห่งนี้ไว้ด้วยการสนับสนุน Source Code 2.0 ของทีมงานไทยครีเอท