Quantcast
Channel: Web Forms
Viewing all articles
Browse latest Browse all 23244

SQL query results into WebForm for Data Entry

$
0
0

This is my second post - same issue. Just can't get it done.

I am working on a page - that will first seach database for existing records and populate the result into WebForm that will be filled and submitted by users for data entry. If no records are found then user will fill in the field.

Searched and found posts about using repeaters - can't get it to work.

Anybody willing to work on this and help out?

Below is my page without the repeater. I've been staring at this for weeks.

*****************************


<head>
<meta content="en-us" http-equiv="Content-Language">
<style type="text/css">
.auto-style1 {
 font-family: Calibri;
 font-size: 9pt;
}
.auto-style2 {
 color: #000080;
 font-family: Calibri;
 font-size: 12pt;
}
</style>
</head>

<p class="auto-style2"><strong>Trade Entry</strong></p>
<form id="form1" runat="server">
 <div>
  <asp:TextBox id="ACCTNO" runat="server"></asp:TextBox>
  <br><input name="Submit1" type="submit" value="submit"></div>
 <table cellspacing="1" style="width: 630px">
  <tr>
   <td>
   <asp:SqlDataSource id="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:smc %>" DeleteCommand="DELETE FROM [TRANSACTIONS] WHERE [Transaction_ID] = @Transaction_ID" InsertCommand="INSERT INTO [TRANSACTIONS] ([ACCOUNT_NUMBER], [Frst_Name], [Name], [SYMBOL], [DATE], [DATE_SOLD], [Order_No], [NO_OF_SHARE_SOLD], [SALE_PRICE], [SALE_TYPE], [WHERE_SOLD], [GRANT_NO], [GRANT_EXERCISED], [GRANT_TYPE], [GRANT_DATE], [EXERCISE_PRICE], [PROCEEDS_PAY], [METHOD_OF_PAY], [PAYOUT_BY], [COMMENTS], [TRADE_COMMENTS], [TRADE_TAKEN_BY], [REP_FOR_DW]) VALUES (@ACCOUNT_NUMBER, @Frst_Name, @Name, @SYMBOL, @DATE, @DATE_SOLD, @Order_No, @NO_OF_SHARE_SOLD, @SALE_PRICE, @SALE_TYPE, @WHERE_SOLD, @GRANT_NO, @GRANT_EXERCISED, @GRANT_TYPE, @GRANT_DATE, @EXERCISE_PRICE, @PROCEEDS_PAY, @METHOD_OF_PAY, @PAYOUT_BY, @COMMENTS, @TRADE_COMMENTS, @TRADE_TAKEN_BY, @REP_FOR_DW)" SelectCommand="SELECT [Transaction_ID], [ACCOUNT_NUMBER], [Frst_Name], [Name], [SYMBOL], [DATE], [DATE_SOLD], [Order_No], [NO_OF_SHARE_SOLD], [SALE_PRICE], [SALE_TYPE], [WHERE_SOLD], [GRANT_NO], [GRANT_EXERCISED], [GRANT_TYPE], [GRANT_DATE], [EXERCISE_PRICE], [PROCEEDS_PAY], [METHOD_OF_PAY], [PAYOUT_BY], [COMMENTS], [TRADE_COMMENTS], [TRADE_TAKEN_BY], [REP_FOR_DW] FROM [TRANSACTIONS] WHERE ([ACCOUNT_NUMBER] = @ACCOUNT_NUMBER)" UpdateCommand="UPDATE [TRANSACTIONS] SET [ACCOUNT_NUMBER] = @ACCOUNT_NUMBER, [Frst_Name] = @Frst_Name, [Name] = @Name, [SYMBOL] = @SYMBOL, [DATE] = @DATE, [DATE_SOLD] = @DATE_SOLD, [Order_No] = @Order_No, [NO_OF_SHARE_SOLD] = @NO_OF_SHARE_SOLD, [SALE_PRICE] = @SALE_PRICE, [SALE_TYPE] = @SALE_TYPE, [WHERE_SOLD] = @WHERE_SOLD, [GRANT_NO] = @GRANT_NO, [GRANT_EXERCISED] = @GRANT_EXERCISED, [GRANT_TYPE] = @GRANT_TYPE, [GRANT_DATE] = @GRANT_DATE, [EXERCISE_PRICE] = @EXERCISE_PRICE, [PROCEEDS_PAY] = @PROCEEDS_PAY, [METHOD_OF_PAY] = @METHOD_OF_PAY, [PAYOUT_BY] = @PAYOUT_BY, [COMMENTS] = @COMMENTS, [TRADE_COMMENTS] = @TRADE_COMMENTS, [TRADE_TAKEN_BY] = @TRADE_TAKEN_BY, [REP_FOR_DW] = @REP_FOR_DW WHERE [Transaction_ID] = @Transaction_ID">
    <DeleteParameters>
     <asp:Parameter Name="Transaction_ID" Type="Decimal" />
    </DeleteParameters>
    <InsertParameters>
     <asp:Parameter Name="ACCOUNT_NUMBER" Type="String" />
     <asp:Parameter Name="Frst_Name" Type="String" />
     <asp:Parameter Name="Name" Type="String" />
     <asp:Parameter Name="SYMBOL" Type="String" />
     <asp:Parameter Name="DATE" Type="DateTime" />
     <asp:Parameter Name="DATE_SOLD" Type="DateTime" />
     <asp:Parameter Name="Order_No" Type="String" />
     <asp:Parameter Name="NO_OF_SHARE_SOLD" Type="Decimal" />
     <asp:Parameter Name="SALE_PRICE" Type="Decimal" />
     <asp:Parameter Name="SALE_TYPE" Type="String" />
     <asp:Parameter Name="WHERE_SOLD" Type="String" />
     <asp:Parameter Name="GRANT_NO" Type="String" />
     <asp:Parameter Name="GRANT_EXERCISED" Type="Decimal" />
     <asp:Parameter Name="GRANT_TYPE" Type="String" />
     <asp:Parameter Name="GRANT_DATE" Type="DateTime" />
     <asp:Parameter Name="EXERCISE_PRICE" Type="Decimal" />
     <asp:Parameter Name="PROCEEDS_PAY" Type="DateTime" />
     <asp:Parameter Name="METHOD_OF_PAY" Type="String" />
     <asp:Parameter Name="PAYOUT_BY" Type="String" />
     <asp:Parameter Name="COMMENTS" Type="String" />
     <asp:Parameter Name="TRADE_COMMENTS" Type="String" />
     <asp:Parameter Name="TRADE_TAKEN_BY" Type="String" />
     <asp:Parameter Name="REP_FOR_DW" Type="String" />
    </InsertParameters>
    <SelectParameters>
     <asp:ControlParameter ControlID="ACCTNO" Name="ACCOUNT_NUMBER" PropertyName="Text" Type="String" />
    </SelectParameters>
    <UpdateParameters>
     <asp:Parameter Name="ACCOUNT_NUMBER" Type="String" />
     <asp:Parameter Name="Frst_Name" Type="String" />
     <asp:Parameter Name="Name" Type="String" />
     <asp:Parameter Name="SYMBOL" Type="String" />
     <asp:Parameter Name="DATE" Type="DateTime" />
     <asp:Parameter Name="DATE_SOLD" Type="DateTime" />
     <asp:Parameter Name="Order_No" Type="String" />
     <asp:Parameter Name="NO_OF_SHARE_SOLD" Type="Decimal" />
     <asp:Parameter Name="SALE_PRICE" Type="Decimal" />
     <asp:Parameter Name="SALE_TYPE" Type="String" />
     <asp:Parameter Name="WHERE_SOLD" Type="String" />
     <asp:Parameter Name="GRANT_NO" Type="String" />
     <asp:Parameter Name="GRANT_EXERCISED" Type="Decimal" />
     <asp:Parameter Name="GRANT_TYPE" Type="String" />
     <asp:Parameter Name="GRANT_DATE" Type="DateTime" />
     <asp:Parameter Name="EXERCISE_PRICE" Type="Decimal" />
     <asp:Parameter Name="PROCEEDS_PAY" Type="DateTime" />
     <asp:Parameter Name="METHOD_OF_PAY" Type="String" />
     <asp:Parameter Name="PAYOUT_BY" Type="String" />
     <asp:Parameter Name="COMMENTS" Type="String" />
     <asp:Parameter Name="TRADE_COMMENTS" Type="String" />
     <asp:Parameter Name="TRADE_TAKEN_BY" Type="String" />
     <asp:Parameter Name="REP_FOR_DW" Type="String" />
     <asp:Parameter Name="Transaction_ID" Type="Decimal" />
    </UpdateParameters>
   </asp:SqlDataSource>
   </td>
  </tr>
  <tr>
   <td>
   <asp:FormView id="FormView1" runat="server" DataKeyNames="Transaction_ID" DataSourceID="SqlDataSource1" DefaultMode="Insert">
    <EditItemTemplate>
     Transaction_ID:
     <asp:Label id="Transaction_IDLabel1" runat="server" Text='<%# Eval("Transaction_ID") %>' />
     <br />
     ACCOUNT_NUMBER:
     <asp:TextBox id="ACCOUNT_NUMBERTextBox" runat="server" Text='<%# Bind("ACCOUNT_NUMBER") %>' />
     <br />
     Frst_Name:
     <asp:TextBox id="Frst_NameTextBox" runat="server" Text='<%# Bind("Frst_Name") %>' />
     <br />
     Name:
     <asp:TextBox id="NameTextBox" runat="server" Text='<%# Bind("Name") %>' />
     <br />
     SYMBOL:
     <asp:TextBox id="SYMBOLTextBox" runat="server" Text='<%# Bind("SYMBOL") %>' />
     <br />
     DATE:
     <asp:TextBox id="DATETextBox" runat="server" Text='<%# Bind("DATE") %>' />
     <br />
     DATE_SOLD:
     <asp:TextBox id="DATE_SOLDTextBox" runat="server" Text='<%# Bind("DATE_SOLD") %>' />
     <br />
     Order_No:
     <asp:TextBox id="Order_NoTextBox" runat="server" Text='<%# Bind("Order_No") %>' />
     <br />
     NO_OF_SHARE_SOLD:
     <asp:TextBox id="NO_OF_SHARE_SOLDTextBox" runat="server" Text='<%# Bind("NO_OF_SHARE_SOLD") %>' />
     <br />
     SALE_PRICE:
     <asp:TextBox id="SALE_PRICETextBox" runat="server" Text='<%# Bind("SALE_PRICE") %>' />
     <br />
     SALE_TYPE:
     <asp:TextBox id="SALE_TYPETextBox" runat="server" Text='<%# Bind("SALE_TYPE") %>' />
     <br />
     WHERE_SOLD:
     <asp:TextBox id="WHERE_SOLDTextBox" runat="server" Text='<%# Bind("WHERE_SOLD") %>' />
     <br />
     GRANT_NO:
     <asp:TextBox id="GRANT_NOTextBox" runat="server" Text='<%# Bind("GRANT_NO") %>' />
     <br />
     GRANT_EXERCISED:
     <asp:TextBox id="GRANT_EXERCISEDTextBox" runat="server" Text='<%# Bind("GRANT_EXERCISED") %>' />
     <br />
     GRANT_TYPE:
     <asp:TextBox id="GRANT_TYPETextBox" runat="server" Text='<%# Bind("GRANT_TYPE") %>' />
     <br />
     GRANT_DATE:
     <asp:TextBox id="GRANT_DATETextBox" runat="server" Text='<%# Bind("GRANT_DATE") %>' />
     <br />
     EXERCISE_PRICE:
     <asp:TextBox id="EXERCISE_PRICETextBox" runat="server" Text='<%# Bind("EXERCISE_PRICE") %>' />
     <br />
     PROCEEDS_PAY:
     <asp:TextBox id="PROCEEDS_PAYTextBox" runat="server" Text='<%# Bind("PROCEEDS_PAY") %>' />
     <br />
     METHOD_OF_PAY:
     <asp:TextBox id="METHOD_OF_PAYTextBox" runat="server" Text='<%# Bind("METHOD_OF_PAY") %>' />
     <br />
     PAYOUT_BY:
     <asp:TextBox id="PAYOUT_BYTextBox" runat="server" Text='<%# Bind("PAYOUT_BY") %>' />
     <br />
     COMMENTS:
     <asp:TextBox id="COMMENTSTextBox" runat="server" Text='<%# Bind("COMMENTS") %>' />
     <br />
     TRADE_COMMENTS:
     <asp:TextBox id="TRADE_COMMENTSTextBox" runat="server" Text='<%# Bind("TRADE_COMMENTS") %>' />
     <br />
     TRADE_TAKEN_BY:
     <asp:TextBox id="TRADE_TAKEN_BYTextBox" runat="server" Text='<%# Bind("TRADE_TAKEN_BY") %>' />
     <br />
     REP_FOR_DW:
     <asp:TextBox id="REP_FOR_DWTextBox" runat="server" Text='<%# Bind("REP_FOR_DW") %>' />
     <br />
     <asp:LinkButton id="UpdateButton" runat="server" CausesValidation="True" CommandName="Update" Text="Update" />
     &nbsp;<asp:LinkButton id="UpdateCancelButton" runat="server" CausesValidation="False" CommandName="Cancel" Text="Cancel" />
    </EditItemTemplate>
    <InsertItemTemplate>
     <span class="auto-style1">Acct No: </span>
     <asp:TextBox id="ACCOUNT_NUMBERTextBox" runat="server" Font-Names="Calibri" Font-Size="9pt" Text='<%# Bind("ACCOUNT_NUMBER") %>' />
     <br class="auto-style1" />
     <span class="auto-style1">First Name: </span>
     <asp:TextBox id="Frst_NameTextBox" runat="server" Font-Names="Calibri" Font-Size="9pt" Text='<%# Bind("Frst_Name") %>' />
     <br class="auto-style1" />
     <span class="auto-style1">Last Name: </span>
     <asp:TextBox id="NameTextBox" runat="server" Font-Names="Calibri" Font-Size="9pt" Text='<%# Bind("Name") %>' />
     <br class="auto-style1" />
     <span class="auto-style1">SYMBOL: </span>
     <asp:TextBox id="SYMBOLTextBox" runat="server" Font-Names="Calibri" Font-Size="9pt" Text='<%# Bind("SYMBOL") %>' />
     <br class="auto-style1" />
     <span class="auto-style1">DATE: </span>
     <asp:TextBox id="DATETextBox" runat="server" Font-Names="Calibri" Font-Size="9pt" Text='<%# Bind("DATE") %>' />
     <br class="auto-style1" />
     <span class="auto-style1">DATE_SOLD: </span>
     <asp:TextBox id="DATE_SOLDTextBox" runat="server" Font-Names="Calibri" Font-Size="9pt" Text='<%# Bind("DATE_SOLD") %>' />
     <br class="auto-style1" />
     <span class="auto-style1">Order_No: </span>
     <asp:TextBox id="Order_NoTextBox" runat="server" Font-Names="Calibri" Font-Size="9pt" Text='<%# Bind("Order_No") %>' />
     <br class="auto-style1" />
     <span class="auto-style1">Shares Sold: </span>
     <asp:TextBox id="NO_OF_SHARE_SOLDTextBox" runat="server" Font-Names="Calibri" Font-Size="9pt" Text='<%# Bind("NO_OF_SHARE_SOLD") %>' />
     <br class="auto-style1" />
     <span class="auto-style1">SALE PRICE: </span>
     <asp:TextBox id="SALE_PRICETextBox" runat="server" Font-Names="Calibri" Font-Size="9pt" Text='<%# Bind("SALE_PRICE") %>' />
     <br class="auto-style1" />
     <span class="auto-style1">SALE TYPE: </span>
     <asp:TextBox id="SALE_TYPETextBox" runat="server" Font-Names="Calibri" Font-Size="9pt" Text='<%# Bind("SALE_TYPE") %>' />
     <br class="auto-style1" />
     <span class="auto-style1">WHERE SOLD: </span>
     <asp:TextBox id="WHERE_SOLDTextBox" runat="server" Font-Names="Calibri" Font-Size="9pt" Text='<%# Bind("WHERE_SOLD") %>' />
     <br class="auto-style1" />
     <span class="auto-style1">GRANT NO: </span>
     <asp:TextBox id="GRANT_NOTextBox" runat="server" Font-Names="Calibri" Font-Size="9pt" Text='<%# Bind("GRANT_NO") %>' />
     <br class="auto-style1" />
     <span class="auto-style1">GRANT EXERCISED: </span>
     <asp:TextBox id="GRANT_EXERCISEDTextBox" runat="server" Font-Names="Calibri" Font-Size="9pt" Text='<%# Bind("GRANT_EXERCISED") %>' />
     <br class="auto-style1" />
     <span class="auto-style1">GRANT TYPE: </span>
     <asp:TextBox id="GRANT_TYPETextBox" runat="server" Font-Names="Calibri" Font-Size="9pt" Text='<%# Bind("GRANT_TYPE") %>' />
     <br class="auto-style1" />
     <span class="auto-style1">GRANT DATE: </span>
     <asp:TextBox id="GRANT_DATETextBox" runat="server" Font-Names="Calibri" Font-Size="9pt" Text='<%# Bind("GRANT_DATE") %>' />
     <br class="auto-style1" />
     <span class="auto-style1">EXERCISE PRICE: </span>
     <asp:TextBox id="EXERCISE_PRICETextBox" runat="server" Font-Names="Calibri" Font-Size="9pt" Text='<%# Bind("EXERCISE_PRICE") %>' />
     <br class="auto-style1" />
     <span class="auto-style1">PROCEEDS PAY: </span>
     <asp:TextBox id="PROCEEDS_PAYTextBox" runat="server" Font-Names="Calibri" Font-Size="9pt" Text='<%# Bind("PROCEEDS_PAY") %>' />
     <br class="auto-style1" />
     <span class="auto-style1">METHOD OF PAY: </span>
     <asp:TextBox id="METHOD_OF_PAYTextBox" runat="server" Font-Names="Calibri" Font-Size="9pt" Text='<%# Bind("METHOD_OF_PAY") %>' />
     <br class="auto-style1" />
     <span class="auto-style1">PAYOUT BY: </span>
     <asp:TextBox id="PAYOUT_BYTextBox" runat="server" Font-Names="Calibri" Font-Size="9pt" Text='<%# Bind("PAYOUT_BY") %>' />
     <br class="auto-style1" />
     <span class="auto-style1">COMMENTS: </span>
     <asp:TextBox id="COMMENTSTextBox" runat="server" Font-Names="Calibri" Font-Size="9pt" Text='<%# Bind("COMMENTS") %>' />
     <br class="auto-style1" />
     <span class="auto-style1">TRADE COMMENTS: </span>
     <asp:TextBox id="TRADE_COMMENTSTextBox" runat="server" Font-Names="Calibri" Font-Size="9pt" Text='<%# Bind("TRADE_COMMENTS") %>' />
     <br class="auto-style1" />
     <span class="auto-style1">TRADE TAKEN BY: </span>
     <asp:TextBox id="TRADE_TAKEN_BYTextBox" runat="server" Font-Names="Calibri" Font-Size="9pt" Text='<%# Bind("TRADE_TAKEN_BY") %>' />
     <br class="auto-style1" />
     <span class="auto-style1">REP FOR DW: </span>
     <asp:TextBox id="REP_FOR_DWTextBox" runat="server" Font-Names="Calibri" Font-Size="9pt" Text='<%# Bind("REP_FOR_DW") %>' />
     <br class="auto-style1" />
     <asp:LinkButton id="InsertButton" runat="server" CausesValidation="True" CommandName="Insert" Font-Names="Calibri" Font-Size="9pt" Text="Insert" />
&nbsp;<asp:LinkButton id="InsertCancelButton" runat="server" CausesValidation="False" CommandName="Cancel" Font-Names="Calibri" Font-Size="9pt" Text="Cancel" />
    </InsertItemTemplate>
    <ItemTemplate>
     Transaction_ID:
     <asp:Label id="Transaction_IDLabel" runat="server" Text='<%# Eval("Transaction_ID") %>' />
     <br />
     ACCOUNT_NUMBER:
     <asp:Label id="ACCOUNT_NUMBERLabel" runat="server" Text='<%# Bind("ACCOUNT_NUMBER") %>' />
     <br />
     Frst_Name:
     <asp:Label id="Frst_NameLabel" runat="server" Text='<%# Bind("Frst_Name") %>' />
     <br />
     Name:
     <asp:Label id="NameLabel" runat="server" Text='<%# Bind("Name") %>' />
     <br />
     SYMBOL:
     <asp:Label id="SYMBOLLabel" runat="server" Text='<%# Bind("SYMBOL") %>' />
     <br />
     DATE:
     <asp:Label id="DATELabel" runat="server" Text='<%# Bind("DATE") %>' />
     <br />
     DATE_SOLD:
     <asp:Label id="DATE_SOLDLabel" runat="server" Text='<%# Bind("DATE_SOLD") %>' />
     <br />
     Order_No:
     <asp:Label id="Order_NoLabel" runat="server" Text='<%# Bind("Order_No") %>' />
     <br />
     NO_OF_SHARE_SOLD:
     <asp:Label id="NO_OF_SHARE_SOLDLabel" runat="server" Text='<%# Bind("NO_OF_SHARE_SOLD") %>' />
     <br />
     SALE_PRICE:
     <asp:Label id="SALE_PRICELabel" runat="server" Text='<%# Bind("SALE_PRICE") %>' />
     <br />
     SALE_TYPE:
     <asp:Label id="SALE_TYPELabel" runat="server" Text='<%# Bind("SALE_TYPE") %>' />
     <br />
     WHERE_SOLD:
     <asp:Label id="WHERE_SOLDLabel" runat="server" Text='<%# Bind("WHERE_SOLD") %>' />
     <br />
     GRANT_NO:
     <asp:Label id="GRANT_NOLabel" runat="server" Text='<%# Bind("GRANT_NO") %>' />
     <br />
     GRANT_EXERCISED:
     <asp:Label id="GRANT_EXERCISEDLabel" runat="server" Text='<%# Bind("GRANT_EXERCISED") %>' />
     <br />
     GRANT_TYPE:
     <asp:Label id="GRANT_TYPELabel" runat="server" Text='<%# Bind("GRANT_TYPE") %>' />
     <br />
     GRANT_DATE:
     <asp:Label id="GRANT_DATELabel" runat="server" Text='<%# Bind("GRANT_DATE") %>' />
     <br />
     EXERCISE_PRICE:
     <asp:Label id="EXERCISE_PRICELabel" runat="server" Text='<%# Bind("EXERCISE_PRICE") %>' />
     <br />
     PROCEEDS_PAY:
     <asp:Label id="PROCEEDS_PAYLabel" runat="server" Text='<%# Bind("PROCEEDS_PAY") %>' />
     <br />
     METHOD_OF_PAY:
     <asp:Label id="METHOD_OF_PAYLabel" runat="server" Text='<%# Bind("METHOD_OF_PAY") %>' />
     <br />
     PAYOUT_BY:
     <asp:Label id="PAYOUT_BYLabel" runat="server" Text='<%# Bind("PAYOUT_BY") %>' />
     <br />
     COMMENTS:
     <asp:Label id="COMMENTSLabel" runat="server" Text='<%# Bind("COMMENTS") %>' />
     <br />
     TRADE_COMMENTS:
     <asp:Label id="TRADE_COMMENTSLabel" runat="server" Text='<%# Bind("TRADE_COMMENTS") %>' />
     <br />
     TRADE_TAKEN_BY:
     <asp:Label id="TRADE_TAKEN_BYLabel" runat="server" Text='<%# Bind("TRADE_TAKEN_BY") %>' />
     <br />
     REP_FOR_DW:
     <asp:Label id="REP_FOR_DWLabel" runat="server" Text='<%# Bind("REP_FOR_DW") %>' />
     <br />
     <asp:LinkButton id="EditButton" runat="server" CausesValidation="False" CommandName="Edit" Text="Edit" />
     &nbsp;<asp:LinkButton id="DeleteButton" runat="server" CausesValidation="False" CommandName="Delete" Text="Delete" />
     &nbsp;<asp:LinkButton id="NewButton" runat="server" CausesValidation="False" CommandName="New" Text="New" />
    </ItemTemplate>
   </asp:FormView>
   </td>
  </tr>
 </table>
</form>


Viewing all articles
Browse latest Browse all 23244

Trending Articles