ASP.NET(vb.net) AccessDataSource & Command Example code how to use ASP.NET bind data from AccessDataSource and auto generate Command.
ShotDev Focus:
- ASP.NET(vb.net) AccessDataSource & Command
Example
AspNetAccessDataSourceCommand.aspx
<%@ Page Language="VB" %> <html> <head> <title>ShotDev.Com Tutorial</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>
Create a asp.net file and save to path root-path/dotnet/
Run
http://localhost/dotnet/AspNetAccessDataSourceCommand.aspx
Screenshot