displaying data from MS access .mdb database

bizjosh

Member
Joined
Mar 16, 2005
Messages
23
Programming Experience
Beginner
i wish to display data from the fields i created in a
MS access .mdb database i.e name, phone, address,
zip, gender, into a table using dreamweaver mx, i
was told to use asp .net , please advise how do i
do this or is there any samples i can look at.
 
bizjosh said:
i wish to display data from the fields i created in a
MS access .mdb database i.e name, phone, address,
zip, gender, into a table using dreamweaver mx, i
was told to use asp .net , please advise how do i
do this or is there any samples i can look at.

Dreamweaver ??? is that your favourite tool for asp.net? i don't think so ...

We could help you there but not through dreamweaver .. please ;)

Cheers :)
 
This should help

VB.NET:
[size=2][color=#0000ff]<%@ Import Namespace="System.Data.OleDb" %>
<[/color][/size][size=2][color=#800000]script[/color][/size][size=2] [/size][size=2][color=#ff0000]runat[/color][/size][size=2][color=#0000ff]="server">
[/color][/size][size=2][/size][size=2][color=#0000ff]Sub[/color][/size][size=2] Page_Load

[/size][size=2][color=#0000ff]Dim[/color][/size][size=2] conPubs [/size][size=2][color=#0000ff]As[/color][/size][size=2] OleDbConnection

[/size][size=2][color=#0000ff]Dim[/color][/size][size=2] cmdSelect [/size][size=2][color=#0000ff]As[/color][/size][size=2] OleDbCommand

[/size][size=2][color=#0000ff]Dim[/color][/size][size=2] reader [/size][size=2][color=#0000ff]As[/color][/size][size=2] OleDbDataReader



[/size][size=2][color=#008000]' Retrieve records from database

[/color][/size][size=2]conPubs = [/size][size=2][color=#0000ff]New[/color][/size][size=2] OleDbConnection( [/size][size=2][color=#800000]"Provider=Microsoft.Jet.OLEDB.4.0; Ole DB Services=-4; Data Source=C:\Inetpub\wwwroot\WebApplication2\bin\addressbook.mdb"[/color][/size][size=2] )

cmdSelect = [/size][size=2][color=#0000ff]New[/color][/size][size=2] OleDbCommand( [/size][size=2][color=#800000]"SELECT [Contacts].* FROM [Contacts]"[/color][/size][size=2], conPubs )

conPubs.Open()

reader = cmdSelect.ExecuteReader()



[/size][size=2][color=#008000]' Bind to Repeater

[/color][/size][size=2]Repeater.DataSource = reader

Repeater.DataBind()



reader.Close()

conPubs.Close()

[/size][size=2][color=#0000ff]End[/color][/size][size=2] [/size][size=2][color=#0000ff]Sub

</[/color][/size][size=2][color=#800000]script[/color][/size][size=2][color=#0000ff]>

<[/color][/size][size=2][color=#800000]asp[/color][/size][size=2][color=#0000ff]:[/color][/size][size=2][color=#800000]Repeater

[/color][/size][size=2][/size][size=2][color=#ff0000]ID[/color][/size][size=2][color=#0000ff]="repeater"

[/color][/size][size=2][/size][size=2][color=#ff0000]Runat[/color][/size][size=2][color=#0000ff]="Server">

[/color][/size][size=2][/size][size=2][color=#0000ff]<[/color][/size][size=2][color=#800000]HeaderTemplate[/color][/size][size=2][color=#0000ff]>

[/color][/size][size=2][/size][size=2][color=#0000ff]<[/color][/size][size=2][color=#800000]table[/color][/size][size=2] [/size][size=2][color=#ff0000]border[/color][/size][size=2][color=#0000ff]=1[/color][/size][size=2] [/size][size=2][color=#ff0000]cellpadding[/color][/size][size=2][color=#0000ff]=4>

[/color][/size][size=2][/size][size=2][color=#0000ff]<[/color][/size][size=2][color=#800000]tr[/color][/size][size=2] [/size][size=2][color=#ff0000]bgcolor[/color][/size][size=2][color=#0000ff]="#eeeeee">

[/color][/size][size=2][/size][size=2][color=#0000ff]<[/color][/size][size=2][color=#800000]th[/color][/size][size=2][color=#0000ff]>[/color][/size][size=2]First Name[/size][size=2][color=#0000ff]</[/color][/size][size=2][color=#800000]th[/color][/size][size=2][color=#0000ff]>

[/color][/size][size=2][/size][size=2][color=#0000ff]<[/color][/size][size=2][color=#800000]th[/color][/size][size=2][color=#0000ff]>[/color][/size][size=2]Last Name[/size][size=2][color=#0000ff]</[/color][/size][size=2][color=#800000]th[/color][/size][size=2][color=#0000ff]>

[/color][/size][size=2][/size][size=2][color=#0000ff]<[/color][/size][size=2][color=#800000]th[/color][/size][size=2][color=#0000ff]>[/color][/size][size=2]Phone[/size][size=2][color=#0000ff]</[/color][/size][size=2][color=#800000]th[/color][/size][size=2][color=#0000ff]>

[/color][/size][size=2][/size][size=2][color=#0000ff]</[/color][/size][size=2][color=#800000]tr[/color][/size][size=2][color=#0000ff]>

[/color][/size][size=2][/size][size=2][color=#0000ff]</[/color][/size][size=2][color=#800000]HeaderTemplate[/color][/size][size=2][color=#0000ff]>

[/color][/size][size=2][/size][size=2][color=#0000ff]<[/color][/size][size=2][color=#800000]ItemTemplate[/color][/size][size=2][color=#0000ff]>

[/color][/size][size=2][/size][size=2][color=#0000ff]<[/color][/size][size=2][color=#800000]tr[/color][/size][size=2][color=#0000ff]>

[/color][/size][size=2][/size][size=2][color=#0000ff]<[/color][/size][size=2][color=#800000]td[/color][/size][size=2][color=#0000ff]>[/color][/size][size=2]<%[/size][size=2][color=#0000ff]#[/color][/size][size=2]Container.DataItem([/size][size=2][color=#800000]"Firstname"[/color][/size][size=2])%>[/size][size=2][color=#0000ff]</[/color][/size][size=2][color=#800000]td[/color][/size][size=2][color=#0000ff]>

[/color][/size][size=2][/size][size=2][color=#0000ff]<[/color][/size][size=2][color=#800000]td[/color][/size][size=2][color=#0000ff]>[/color][/size][size=2]<%[/size][size=2][color=#0000ff]#[/color][/size][size=2]Container.DataItem([/size][size=2][color=#800000]"Lastname"[/color][/size][size=2])%>[/size][size=2][color=#0000ff]</[/color][/size][size=2][color=#800000]td[/color][/size][size=2][color=#0000ff]>

[/color][/size][size=2][/size][size=2][color=#0000ff]<[/color][/size][size=2][color=#800000]td[/color][/size][size=2][color=#0000ff]>[/color][/size][size=2]<%[/size][size=2][color=#0000ff]#[/color][/size][size=2]Container.DataItem([/size][size=2][color=#800000]"Homephone"[/color][/size][size=2])%>[/size][size=2][color=#0000ff]</[/color][/size][size=2][color=#800000]td[/color][/size][size=2][color=#0000ff]>

[/color][/size][size=2][/size][size=2][color=#0000ff]</[/color][/size][size=2][color=#800000]tr[/color][/size][size=2][color=#0000ff]>

[/color][/size][size=2][/size][size=2][color=#0000ff]</[/color][/size][size=2][color=#800000]ItemTemplate[/color][/size][size=2][color=#0000ff]>

[/color][/size][size=2][/size][size=2][color=#0000ff]<[/color][/size][size=2][color=#800000]AlternatingItemTemplate[/color][/size][size=2][color=#0000ff]>

[/color][/size][size=2][/size][size=2][color=#0000ff]<[/color][/size][size=2][color=#800000]tr[/color][/size][size=2] [/size][size=2][color=#ff0000]bgcolor[/color][/size][size=2][color=#0000ff]="lightyellow">

[/color][/size][size=2][/size][size=2][color=#0000ff]<[/color][/size][size=2][color=#800000]td[/color][/size][size=2][color=#0000ff]>[/color][/size][size=2]<%[/size][size=2][color=#0000ff]#[/color][/size][size=2]Container.DataItem([/size][size=2][color=#800000]"Firstname"[/color][/size][size=2])%>[/size][size=2][color=#0000ff]</[/color][/size][size=2][color=#800000]td[/color][/size][size=2][color=#0000ff]>

[/color][/size][size=2][/size][size=2][color=#0000ff]<[/color][/size][size=2][color=#800000]td[/color][/size][size=2][color=#0000ff]>[/color][/size][size=2]<%[/size][size=2][color=#0000ff]#[/color][/size][size=2]Container.DataItem([/size][size=2][color=#800000]"Lastname"[/color][/size][size=2])%>[/size][size=2][color=#0000ff]</[/color][/size][size=2][color=#800000]td[/color][/size][size=2][color=#0000ff]>

[/color][/size][size=2][/size][size=2][color=#0000ff]<[/color][/size][size=2][color=#800000]td[/color][/size][size=2][color=#0000ff]>[/color][/size][size=2]<%[/size][size=2][color=#0000ff]#[/color][/size][size=2]Container.DataItem([/size][size=2][color=#800000]"Homephone"[/color][/size][size=2])%>[/size][size=2][color=#0000ff]</[/color][/size][size=2][color=#800000]td[/color][/size][size=2][color=#0000ff]>

[/color][/size][size=2][/size][size=2][color=#0000ff]</[/color][/size][size=2][color=#800000]tr[/color][/size][size=2][color=#0000ff]>

[/color][/size][size=2][/size][size=2][color=#0000ff]</[/color][/size][size=2][color=#800000]AlternatingItemTemplate[/color][/size][size=2][color=#0000ff]>

[/color][/size][size=2][/size][size=2][color=#0000ff]<[/color][/size][size=2][color=#800000]FooterTemplate[/color][/size][size=2][color=#0000ff]>

[/color][/size][size=2][/size][size=2][color=#0000ff]</[/color][/size][size=2][color=#800000]table[/color][/size][size=2][color=#0000ff]>

[/color][/size][size=2][/size][size=2][color=#0000ff]</[/color][/size][size=2][color=#800000]FooterTemplate[/color][/size][size=2][color=#0000ff]>

</[/color][/size][size=2][color=#800000]asp[/color][/size][size=2][color=#0000ff]:[/color][/size][size=2][color=#800000]Repeater[/color][/size][size=2][color=#0000ff]>

[/color][/size]
 
thanks, what if the user is allowed to update the Name, by putting
a textbox inside, how can it be updated?

<AlternatingItemTemplate>

<trbgcolor="lightyellow">

<td><asp:Textbox id=Firstname Text=<%#Container.DataItem("Firstname")%></td>

<td><asp:Textbox id=Lastname Text=<%#Container.DataItem("Lastname")%></td>

<td><%#Container.DataItem("Homephone")%></td>

</tr>

</AlternatingItemTemplate>
 
Back
Top