?
Solved

three lines to understand

Posted on 2005-03-25
2
Medium Priority
?
207 Views
Last Modified: 2010-04-07
Hi experts ...
i am new in asp.net .. i run this example in my pc ..it works fine .. i just want to know what is meant by thses three lines :
dbread=dbcomm.ExecuteReader()
customers.DataSource=dbread
customers.DataBind()
/////////////////////////////
this is the whole code
<%@ Import Namespace="System.Data.OleDb" %>
<HTML>
      <script runat="server">
sub Page_Load
dim dbconn,sql,dbcomm,dbread
dbconn=New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;data source=" & server.mappath("db/northwind.mdb"))
dbconn.Open()
sql="SELECT * FROM customers"
dbcomm=New OleDbCommand(sql,dbconn)
dbread=dbcomm.ExecuteReader()
customers.DataSource=dbread
customers.DataBind()
dbread.Close()
dbconn.Close()
end sub
      </script>
      <body>
            <form runat="server" ID="Form1">
                  <asp:Repeater id="customers" runat="server">
                        <HeaderTemplate>
                              <table border="1" width="100%">
                                    <tr bgcolor="#b0c4de">
                                          <th>
                                                Companyname</th>
                                          <th>
                                                Contactname</th>
                                          <th>
                                                Address</th>
                                          <th>
                                                City</th>
                                    </tr>
                        </HeaderTemplate>
                        <ItemTemplate>
                              <tr bgcolor="#f0f0f0">
                                    <td><%#Container.DataItem("companyname")%>
                                    </td>
                                    <td><%#Container.DataItem("contactname")%>
                                    </td>
                                    <td><%#Container.DataItem("address")%>
                                    </td>
                                    <td><%#Container.DataItem("city")%>
                                    </td>
                              </tr>
                        </ItemTemplate>
                        <FooterTemplate>
                              </table>
                        </FooterTemplate>
                  </asp:Repeater>
            </form>
      </body>
</HTML>
0
Comment
Question by:anasalama
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 4

Accepted Solution

by:
imperial_p79 earned 200 total points
ID: 13635532
dbread=dbcomm.ExecuteReader() // This piece of code executes the command against the database and returns your a datareader.
customers.DataSource=dbread // It assigns the 'customers' datagrid's datasource to the datareader that was returned in the previous statement.
customers.DataBind() // This binds the data in the datareader into the datagrid.

Hope this helps!
0
 

Author Comment

by:anasalama
ID: 13635717
thank's
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question