web 2.0

ASP.NET(vb.net) & AccessDataSource and Listbox

ASP.NET(vb.net) & AccessDataSource and Listbox -  Learn ASP.NET how to using Listbox control and binding datasource from AccessDataSource (Microsoft Access Database)

ShotDev Focus:
- ASP.NET(vb.net) & AccessDataSource and Listbox

ASP.NET(vb.net) & AccessDataSource and Listbox

Example

ASP.NET(vb.net) & AccessDataSource and Listbox

Drag control Listbox to ASP.NET Web Form and Click ListBox Tasks -> Choose Data Source…

ASP.NET(vb.net) & AccessDataSource and Listbox

Choose a Data Source : Select <New data source…>

ASP.NET(vb.net) & AccessDataSource and Listbox

Choose a Data Source Type : Select Access Database and Specify an ID for the data source.

ASP.NET(vb.net) & AccessDataSource and Listbox

Choose a Database Path of Microsoft Access data file:

ASP.NET(vb.net) & AccessDataSource and Listbox

Configure the Select Statement.

ASP.NET(vb.net) & AccessDataSource and Listbox

Test Query and Click Finish

ASP.NET(vb.net) & AccessDataSource and Listbox

Select a data source, Select a data field to display in the Listbox , Select a data field for the value of the Listbox .

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:ListBox ID="ListBox1" runat="server" DataSourceID="AccessDataSource1"
DataTextField="CountryName" DataValueField="CountryCode"></asp:ListBox>
<asp:AccessDataSource ID="AccessDataSource1" runat="server"
DataFile="~/App_Data/mydatabase.mdb" SelectCommand="SELECT * FROM [country]">
</asp:AccessDataSource>

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

Default.aspx.vb


Partial Class _Default
Inherits System.Web.UI.Page

End Class

Screenshot

ASP.NET(vb.net) & AccessDataSource and Listbox

.
.
.
Download this script.
Download

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

Leave a Reply

You must be logged in to post a comment.