Advertisement
Guest User

Untitled

a guest
Oct 26th, 2017
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
ASP 12.41 KB | None | 0 0
  1. <%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>
  2.  
  3. <!DOCTYPE html>
  4. <html>
  5. <head id="Head1" runat="server">
  6.     <title>Manage Data</title>
  7. </head>
  8. <body>
  9.     <form id="form1" runat="server">
  10.         <table bgcolor="gray">
  11.             <%--Authors--%>
  12.             <tr>
  13.                 <td valign="top">
  14.                     <asp:GridView ID="GridView1" AllowSorting="True" AllowPaging="True"
  15.                         runat="server" DataSourceID="SqlDataSource2" DataKeyNames="authorID"
  16.                         AutoGenerateColumns="False" Width="500px" SelectedIndex="0"
  17.                         OnSelectedIndexChanged="GridView1_SelectedIndexChanged"
  18.                         OnPageIndexChanged="GridView1_PageIndexChanged"
  19.                         OnRowDeleted="GridView1_RowDeleted" OnSorted="GridView1_Sorted" BackColor="White"
  20.                         BorderColor="#DEDFDE" BorderStyle="None" BorderWidth="1px" CellPadding="4" ForeColor="Black" GridLines="Vertical">
  21.                             <AlternatingRowStyle BackColor="White" />
  22.                                 <Columns>
  23.                                     <asp:CommandField ShowSelectButton="true" ShowDeleteButton="true" />
  24.                                     <asp:BoundField DataField="authorID" HeaderText="ID" ReadOnly="True"
  25.                                         SortExpression="authorID" InsertVisible="False" />
  26.                                     <asp:BoundField DataField="authorName" HeaderText="Name"
  27.                                         SortExpression="authorName" />
  28.                                 </Columns>
  29.                             <FooterStyle BackColor="#CCCC99" />
  30.                             <HeaderStyle BackColor="#6B696B" Font-Bold="True" ForeColor="White" />
  31.                             <PagerStyle BackColor="#F7F7DE" ForeColor="Black" HorizontalAlign="Right" />
  32.                             <RowStyle BackColor="#F7F7DE" />
  33.                             <SelectedRowStyle BackColor="#CE5D5A" Font-Bold="True" ForeColor="White" />
  34.                             <SortedAscendingCellStyle BackColor="#FBFBF2" />
  35.                             <SortedAscendingHeaderStyle BackColor="#848384" />
  36.                             <SortedDescendingCellStyle BackColor="#EAEAD3" />
  37.                             <SortedDescendingHeaderStyle BackColor="#575357" />
  38.                     </asp:GridView>
  39.  
  40.                     <asp:SqlDataSource ID="SqlDataSource2" runat="server"
  41.                         SelectCommand  = "SELECT authorID, authorName FROM authors"
  42.                         DeleteCommand  = "DELETE FROM authors WHERE authorID = @authorID"
  43.                         ConnectionString="<%$ ConnectionStrings:ConnectionString1 %>"
  44.                         ProviderName="<%$ ConnectionStrings:ConnectionString1.ProviderName %>" >
  45.                     </asp:SqlDataSource>
  46.                 </td>
  47.  
  48.                 <td valign="top">
  49.                     <asp:DetailsView AutoGenerateRows="False" DataKeyNames="authorID"
  50.                         DataSourceID="SqlDataSource3" HeaderText="Author Details"
  51.                         ID="DetailsView1" runat="server" Width="275px"
  52.                         OnItemUpdated="DetailsView1_ItemUpdated"
  53.                         OnItemInserted="DetailsView1_ItemInserted"
  54.                         OnDataBound="DetailsView1_DataBound" BackColor="White" BorderColor="#DEDFDE" BorderStyle="None" BorderWidth="1px" CellPadding="4" ForeColor="Black" GridLines="Vertical" >
  55.  
  56.                         <AlternatingRowStyle BackColor="White" />
  57.                         <EditRowStyle BackColor="#CE5D5A" Font-Bold="True" ForeColor="White" />
  58.  
  59.                         <Fields>
  60.                             <asp:BoundField DataField="authorID" HeaderText="ID" ReadOnly="true"
  61.                                 SortExpression="authorID" />
  62.                             <asp:BoundField DataField="authorName" HeaderText="Name"
  63.                                 SortExpression="authorName" />
  64.                             <asp:BoundField DataField="email" HeaderText="Email"
  65.                                 SortExpression="email" />
  66.                             <asp:BoundField DataField="sex" HeaderText="Sex"
  67.                                 SortExpression="sex" />
  68.                             <asp:CommandField ShowEditButton="True" ShowInsertButton="True" />
  69.                         </Fields>
  70.                         <FooterStyle BackColor="#CCCCCC" />
  71.                         <HeaderStyle BackColor="#6B696B" Font-Bold="True" ForeColor="White" />
  72.                         <PagerStyle BackColor="#F7F7DE" ForeColor="Black" HorizontalAlign="Right" />
  73.                         <RowStyle BackColor="#F7F7DE" />
  74.                     </asp:DetailsView>
  75.  
  76.                     <br />
  77.                     <br />
  78.  
  79.                     <asp:SqlDataSource ID="SqlDataSource3" runat="server"
  80.                         SelectCommand  = "SELECT authorID, authorName, email, sex FROM authors WHERE authorID = ?"
  81.                         UpdateCommand  = "UPDATE authors SET authorName = @authorName, email = @email, sex = @sex WHERE authorID = @authorID"
  82.                         InsertCommand  = "INSERT INTO authors ( authorName, email, sex) VALUES (  @authorName, @email, @sex)"
  83.                         ConnectionString="<%$ ConnectionStrings:ConnectionString5 %>"
  84.                         ProviderName="<%$ ConnectionStrings:ConnectionString5.ProviderName %>" >
  85.  
  86.                         <SelectParameters>
  87.                             <asp:ControlParameter ControlID="GridView1" Name="authorID" PropertyName="SelectedValue" Type="String" />
  88.                         </SelectParameters>
  89.  
  90.                         <UpdateParameters>
  91.                             <asp:Parameter Name="authorName" Type="String" />
  92.                             <asp:Parameter Name="authorID" Type="String" />
  93.                             <asp:Parameter Name="email" Type="String" />
  94.                             <asp:Parameter Name="sex" Type="String" />                          
  95.                         </UpdateParameters>
  96.  
  97.                         <InsertParameters>                            
  98.                             <asp:Parameter Name="authorName" Type="String" />
  99.                             <asp:Parameter Name="email" Type="String" />
  100.                             <asp:Parameter Name="sex" Type="String" />
  101.                         </InsertParameters>
  102.  
  103.                     </asp:SqlDataSource>
  104.                 </td>
  105.             </tr>
  106.        
  107.             <%--Publishers--%>
  108.             <tr>
  109.                 <td valign="top">
  110.                     <asp:GridView ID="GridView2" AllowSorting="True" AllowPaging="True"
  111.                         runat="server" DataSourceID="SqlDataSource1" DataKeyNames="pubID"
  112.                         AutoGenerateColumns="False" Width="500px" SelectedIndex="0"
  113.                         OnSelectedIndexChanged="GridView2_SelectedIndexChanged"
  114.                         OnPageIndexChanged="GridView2_PageIndexChanged"
  115.                         OnRowDeleted="GridView2_RowDeleted" OnSorted="GridView2_Sorted" BackColor="White"
  116.                         BorderColor="#DEDFDE" BorderStyle="None" BorderWidth="1px" CellPadding="4" ForeColor="Black" GridLines="Vertical">
  117.                             <AlternatingRowStyle BackColor="White" />
  118.                                 <Columns>
  119.                                     <asp:CommandField ShowSelectButton="true" ShowDeleteButton="true" />
  120.                                     <asp:BoundField DataField="pubID" HeaderText="PID" ReadOnly="True"
  121.                                         SortExpression="pubID" />
  122.                                     <asp:BoundField DataField="pubName" HeaderText="Name"
  123.                                         SortExpression="pubName" />
  124.                                 </Columns>
  125.                             <FooterStyle BackColor="#CCCC99" />
  126.                             <HeaderStyle BackColor="#6B696B" Font-Bold="True" ForeColor="White" />
  127.                             <PagerStyle BackColor="#F7F7DE" ForeColor="Black" HorizontalAlign="Right" />
  128.                             <RowStyle BackColor="#F7F7DE" />
  129.                             <SelectedRowStyle BackColor="#CE5D5A" Font-Bold="True" ForeColor="White" />
  130.                             <SortedAscendingCellStyle BackColor="#FBFBF2" />
  131.                             <SortedAscendingHeaderStyle BackColor="#848384" />
  132.                             <SortedDescendingCellStyle BackColor="#EAEAD3" />
  133.                             <SortedDescendingHeaderStyle BackColor="#575357" />
  134.                     </asp:GridView>
  135.  
  136.                     <asp:SqlDataSource ID="SqlDataSource1" runat="server"
  137.                         SelectCommand  = "SELECT pubID, pubName FROM publishers"
  138.                         DeleteCommand  = "DELETE FROM publishers WHERE pubID = @pubID"
  139.                         ConnectionString="<%$ ConnectionStrings:ConnectionString6 %>"
  140.                         ProviderName="<%$ ConnectionStrings:ConnectionString6.ProviderName %>" >
  141.                     </asp:SqlDataSource>
  142.                 </td>
  143.  
  144.                 <td valign="top">
  145.                     <asp:DetailsView AutoGenerateRows="False" DataKeyNames="pubID"
  146.                         DataSourceID="SqlDataSource4" HeaderText="Publisher Details"
  147.                         ID="DetailsView2" runat="server" Width="275px"
  148.                         OnItemUpdated="DetailsView2_ItemUpdated"
  149.                         OnItemInserted="DetailsView2_ItemInserted"
  150.                         OnDataBound="DetailsView2_DataBound" BackColor="White" BorderColor="#DEDFDE" BorderStyle="None" BorderWidth="1px" CellPadding="4" ForeColor="Black" GridLines="Vertical" >
  151.  
  152.                         <AlternatingRowStyle BackColor="White" />
  153.                         <EditRowStyle BackColor="#CE5D5A" Font-Bold="True" ForeColor="White" />
  154.  
  155.                         <Fields>
  156.                             <asp:BoundField DataField="pubID" HeaderText="PID" ReadOnly="true"
  157.                                 SortExpression="pubID"/>
  158.                             <asp:BoundField DataField="pubName" HeaderText="Name"
  159.                                 SortExpression="pubName" />
  160.                             <asp:BoundField DataField="pubCity" HeaderText="City"
  161.                                 SortExpression="pubCity" />
  162.                             <asp:CommandField ShowEditButton="True" ShowInsertButton="True" />
  163.                         </Fields>
  164.                         <FooterStyle BackColor="#CCCCCC" />
  165.                         <HeaderStyle BackColor="#6B696B" Font-Bold="True" ForeColor="White" />
  166.                         <PagerStyle BackColor="#F7F7DE" ForeColor="Black" HorizontalAlign="Right" />
  167.                         <RowStyle BackColor="#F7F7DE" />
  168.                     </asp:DetailsView>
  169.  
  170.                     <br />
  171.                     <br />
  172.  
  173.                     <asp:SqlDataSource ID="SqlDataSource4" runat="server"
  174.                         SelectCommand  = "SELECT pubID, pubName, pubCity FROM publishers WHERE (pubID = ?)"
  175.                         UpdateCommand  = "UPDATE publishers SET pubName = @pubName, pubCity = @pubCity WHERE pubID = @pubID"
  176.                         InsertCommand  = "INSERT INTO publishers(pubName, pubCity) VALUES (@pubName, @pubCity)"
  177.                         ConnectionString="<%$ ConnectionStrings:ConnectionString7 %>"
  178.                         ProviderName="<%$ ConnectionStrings:ConnectionString7.ProviderName %>" >
  179.  
  180.                         <SelectParameters>
  181.                             <asp:ControlParameter ControlID="GridView2" Name="pubID" PropertyName="SelectedValue" Type="String" />
  182.                         </SelectParameters>
  183.  
  184.                         <UpdateParameters>
  185.                             <asp:Parameter Name="pubID" Type="String" />
  186.                             <asp:Parameter Name="pubName" Type="String" />
  187.                             <asp:Parameter Name="pubCity" Type="String" />                            
  188.                         </UpdateParameters>
  189.  
  190.                         <InsertParameters>
  191.                             <asp:Parameter Name="pubName" Type="String"/>
  192.                             <asp:Parameter Name="pubCity" Type="String"/>
  193.                         </InsertParameters>
  194.  
  195.                     </asp:SqlDataSource>
  196.                 </td>
  197.             </tr>
  198.         </table>
  199.         <asp:Label ID="ErrorMessageLabel" EnableViewState="false" runat="server" />
  200.     </form>
  201. </body>
  202. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement