web 2.0

ASP.NET(vb.net) & AccessDataSource - asp:AccessDataSource

ASP.NET(vb.net) & AccessDataSource - asp:AccessDataSource Represents a Microsoft Access database to data-bound controls. The AccessDataSource class is a data source control that works with Microsoft Access databases. Like its base class, SqlDataSource, the AccessDataSource control uses SQL queries to perform data retrieval.

ASP.NET(vb.net) & AccessDataSource - asp:AccessDataSource

ASP.NET(vb.net) & AccessDataSource - asp:AccessDataSource

Drag AccessDataSource control to ASP.NET Web Form. On SqlDataSource Tasks ->Coose Data Source.

ASP.NET(vb.net) & AccessDataSource - asp:AccessDataSource

Choose a Database. Enter the relative path to a Microsoft Access database file (*.MDB) or choose Browse to locate the file on your computer.

ASP.NET(vb.net) & AccessDataSource - asp:AccessDataSource

Select Microsoft Access Database.

ASP.NET(vb.net) & AccessDataSource - asp:AccessDataSource

Configure Data Source.

ASP.NET(vb.net) & AccessDataSource - asp:AccessDataSource

Configure the Select Statement.

ASP.NET(vb.net) & AccessDataSource - asp:AccessDataSource

Test Query and Click Finish

ASP.NET(vb.net) & AccessDataSource - asp:AccessDataSource

Drag Gridview control to ASP.NET Web Form and Choose Data Source from SqlDataSource.

Example Code

Default.aspx

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

<!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>ShotDev.Com Tutorial</title>
</head>
<body>
<form id="form1" runat="server">
<div>

<asp:AccessDataSource ID="AccessDataSource1" runat="server"
DataFile="~/App_Data/mydatabase.mdb" SelectCommand="SELECT * FROM [customer]">
</asp:AccessDataSource>
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
DataKeyNames="CustomerID" DataSourceID="AccessDataSource1">
<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>

</div>
</form>
</body>
</html>

Default.aspx.vb

Partial Class _Default
Inherits System.Web.UI.Page

End Class

Screenshot

ASP.NET(vb.net) & AccessDataSource - asp:AccessDataSource
.
.
.

Download this script.

Download
.
.
Other related articles
ASP.NET(vb.net) AccessDataSource & DataFile
ASP.NET(vb.net) AccessDataSource & Command
ASP.NET(vb.net) AccessDataSource & DataBind
ASP.NET(vb.net) AccessDataSource & GridView
ASP.NET(vb.net) AccessDataSource & GridView RowCommand
ASP.NET(vb.net) AccessDataSource & Visual Studio 2005,2008,2010

1 Star2 Stars3 Stars4 Stars5 Stars6 Stars7 Stars8 Stars9 Stars10 Stars (No Ratings Yet)
Loading ... Loading ...

One Response to “ASP.NET(vb.net) & AccessDataSource - asp:AccessDataSource”

  1. 1batter…

Leave a Reply

You must be logged in to post a comment.