<% @ import namespace = "system. data "%>
<% @ import namespace =" system. data. sqlclient "%>
Void page_load (Object semder, eventargs E)
{
// Create a database connection string and sqldataadapter object
String connstr = system. configuration. configurationsettings. etettings ["connectionsqlserver_pubs"];
Sqlconnection myconnection = new sqlconnection (connstr );
Sqldataadapter mycommand = new sqldataadapter ("select * from titles", myconnection );
// Generate a DataSet object and fill in data
Dataset DS = new dataset ();
Mycommand. Fill (DS, "titles ");
// Bind the Repeater control to data
Myrepeater. datasource = Ds. Tables ["titles"]. defaultview;
Myrepeater. databind ();
}
</SCRIPT>
<Body topmargin = "0" leftmargin = "0" marginwidth = "0" marginheight = "0">
<Asp: repeater id = "myrepeater" runat = "server">
<Headertemplate>
<Table width = "100%" style = "Font: 8pt verdana">
<Tr style = "background-color: dfa894">
<TH> title </Th>
<TH> title ID </Th>
<TH> type </Th>
<TH> publisher id </Th>
<TH> price </Th>
</Tr>
</Headertemplate>
<Itemtemplate>
<Tr style = "background-color: ffecd8">
<TD>
<% # Databinder. eval (container. dataitem, "title") %>
</TD>
<TD>
<% # Databinder. eval (container. dataitem, "title_id") %>
</TD>
<TD>
<% # Databinder. eval (container. dataitem, "type") %>
</TD>
<TD>
<% # Databinder. eval (container. dataitem, "pub_id") %>
</TD>
<TD>
<% # Databinder. eval (container. dataitem, "price", "$ {0}") %>
</TD>
</Tr>
</Itemtemplate>
<Footertemplate>
</Table>
</Footertemplate>
</ASP: repeater>
</Body>
</Html>