C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Resources » Articles » ASP.NET/Web Applications »

Bind The Data with Repeater Conrol


Posted Date: 22 May 2004    Resource Type: Articles    Category: ASP.NET/Web Applications
Author: chandrakant SarodeMember Level: Bronze    
Rating: 1 out of 5Points: 7



Create Database Connection for Microsoft Access Databse.

we need to connect Microsoft Access Database we have to use "System.Data.OleDb" Namespace.

here i used to open Links.mdb Databse.

' To Open the Connection

 
<% @ Import Namespace = "System.Data.OleDb"%>

<Script runat = "Server">

Sub Page_Load

Dim DbCn, Sql, DbCmd,DbRead
DbCn = New OleDbConnection _
( "Provider = Microsoft.Jet.OLEDB.4.0;data _
source = " & Server.Mappath ( " Link.mdb "))
DnCn.Open()

' To Create a database Command

Sql = "Select * FROM Branches"

DbCmd = New OledbCommand( Sql, DbCn )

' To Create a DataReader

' The OleDbDataReader Class is used to read a stream of records form a data source
' it is done by Execute Reader Method

DbRead = DbCmd.ExecuteReader( )

' Bind the to Repeater Control

Link.datasource = DbRead

Link.DataBind()

DbRead.Close()

DbCn.Close()

End Sub

</Script>

<html>

<Body>

<Form runat = " Server ">

<asp:Repeater id = "Links" runat = "Server ">

<HeaderTemplate>
<table Boarder = " 1 " width = "100">
<tr>
<th>BranchCode</th>
<th>BranchName</th>
<th>Connected</th>
<th>City</th>
</tr>
</HeaderTemplate>

<ItemTemplate>
<tr>
<td><% # Container.DataItem("Bcode")%></td>
<td><% # Container.DataItem("Bname")%></td>
<td><% # Container.DataItem("Bconnd")%></td>
<td><% # Container.DataItem("Bcity")%></td>
</tr>
</ItemTemplate>

<FooterTempleate>
</table>
</FooterTempleate>

</asp:Repeater>
</Form>
</body>
</html>




Responses


No responses found. Be the first to respond and make money from revenue sharing program.

Feedbacks      
Popular Tags   What are tags ?   Search Tags  
Sign In to add tags.
(No tags found.)

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: Introduction to ADO.NET
Previous Resource: .NET Runtime
Return to Discussion Resource Index
Post New Resource
Category: ASP.NET/Web Applications


Post resources and earn money!
 
Related Resources



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use