Note that there are some explanatory texts on larger screens.

plurals
  1. POASP. NET webpage: create a search box to search data from a table in Oracle
    primarykey
    data
    text
    <p>I'm trying to create an ASP.NET webpage to output a textbox, then user will enter the key in this textbox and I use that key to put into WHERE condition in SQL code to output data that matches the key. For example, user enters ArtistID in the textbox and I need to print the table SPEEDOFSALEREPORT using </p> <blockquote> <p>SELECT * FROM SPEEDOFSALEREPORT WHERE ArtistID = "the key that user just enter"</p> </blockquote> <p>but I don't know how. My code below creates a text box and print all rows in the table. Please give me a hint. I tried googling all days but cannot find the answer. Thank you.</p> <p>This is my updated Default.aspx</p> <pre><code> &lt;body&gt; &lt;form id="form1" runat="server"&gt; &lt;asp:TextBox ID="txtArtistID" runat="server" /&gt;&lt;br /&gt;&lt;br /&gt; &lt;asp:Button ID="btnSearch" runat="server" Text="Search" CssClass="submit" /&gt; &lt;div&gt; &lt;asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataSourceID="SqlDataSource1"&gt; &lt;Columns&gt; &lt;asp:BoundField DataField="TRANSACTIONID" HeaderText="TRANSACTIONID" SortExpression="TRANSACTIONID" /&gt; &lt;asp:BoundField DataField="WORKID" HeaderText="WORKID" SortExpression="WORKID" /&gt; &lt;asp:BoundField DataField="ARTISTID" HeaderText="ARTISTID" SortExpression="ARTISTID" /&gt; &lt;asp:BoundField DataField="DATEACQUIRED" HeaderText="DATEACQUIRED" SortExpression="DATEACQUIRED" /&gt; &lt;asp:BoundField DataField="DATESOLDID" HeaderText="DATESOLDID" SortExpression="DATESOLDID" /&gt; &lt;asp:BoundField DataField="TURNAROUNDDAYS" HeaderText="TURNAROUNDDAYS" SortExpression="TURNAROUNDDAYS" /&gt; &lt;asp:BoundField DataField="ASKINGPRICE" HeaderText="ASKINGPRICE" SortExpression="ASKINGPRICE" /&gt; &lt;asp:BoundField DataField="SALESPRICE" HeaderText="SALESPRICE" SortExpression="SALESPRICE" /&gt; &lt;asp:BoundField DataField="SALESMARGIN" HeaderText="SALESMARGIN" SortExpression="SALESMARGIN" /&gt; &lt;/Columns&gt; &lt;/asp:GridView&gt; &lt;/div&gt; &lt;asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="Data Source=oracle2;User ID=****;Password=****;Unicode=True" ProviderName="System.Data.OracleClient" SelectCommand="SELECT * FROM SPEEDOFSALEREPORT WHERE ARTISTID = @artistID;"&gt; &lt;SelectParameters&gt; &lt;asp:ControlParameter Name="artistID" ControlID="txtArtistID" PropertyName="Text" /&gt; &lt;/SelectParameter&gt; &lt;/asp:SqlDataSource&gt; &lt;/form&gt; &lt;/body&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload