Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to use value from primary accessdatasource control as parameter in select query for secondary accessdatasource control
    primarykey
    data
    text
    <p>I'm trying to display all orders placed and I have a primary accessdatasource control that has a select query to get the customer information and the orderID. I want to use the orderID value from this first query as a parameter for the secondary accessdatasource control that selects the product information of the products in the order. In plain english, I want to:- select product info from product table where orderID = ? (where ? is the orderID value from the first query)</p> <p>I have tried the &lt;%#Eval("OrderID")%> but I get a "server tag not well formed" error, but I do get results returned when I just type the order ID in, but obviously every result (order) just contains the same product info...</p> <pre><code>&lt;asp:Repeater ID="Repeater1" runat="server" DataSourceID="AccessDataSource1"&gt; &lt;ItemTemplate&gt; &lt;asp:AccessDataSource ID="AccessDataSource2" runat="server" DataFile="~/App_Data/project.mdb" SelectCommand="SELECT orderDetails.OrderID, album.Artist, album.Album, album.Cost, album.ImageURL, orderDetails.Quantity, orderDetails.Total FROM (album INNER JOIN orderDetails ON album.AlbumID = orderDetails.AlbumID) WHERE (orderDetails.OrderID = ? )"&gt; &lt;SelectParameters&gt; // Error is on this line &lt;asp:Parameter Name="OrderID" DefaultValue="&lt;%#Eval ("OrderID")%&gt;" /&gt; &lt;/SelectParameters&gt; &lt;/asp:AccessDataSource&gt; &lt;div class="viewAllOrdersOrderArea"&gt; &lt;div class="viewAllOrdersOrderSummary"&gt; &lt;p&gt;&lt;b&gt;Order ID: &lt;/b&gt;&lt;%#Eval("OrderID")%&gt;&lt;/p&gt; &lt;h4&gt;Shipping Details&lt;/h4&gt; &lt;p&gt;&lt;b&gt;Shipping Address: &lt;/b&gt;&lt;%#Eval("ShippingName")%&gt;, &lt;%#Eval("ShippingAddress")%&gt;, &lt;%#Eval("ShippingTown")%&gt;, &lt;%#Eval("ShippingPostcode")%&gt;&lt;/p&gt; &lt;h4&gt;Payment Details&lt;/h4&gt; &lt;p&gt;&lt;b&gt;Cardholder's Address: &lt;/b&gt;&lt;%#Eval("CardHolder")%&gt;, &lt;%#Eval("BillingAddress")%&gt;, &lt;%#Eval("BillingTown")%&gt;, &lt;%#Eval("BillingPostcode")%&gt;&lt;/p&gt; &lt;p&gt;&lt;b&gt;Payment Method: &lt;/b&gt;&lt;%#Eval("CardType")%&gt;&lt;/p&gt; &lt;p&gt;&lt;b&gt;Card Number: &lt;/b&gt;&lt;%#Eval("CardNumber")%&gt;&lt;/p&gt; &lt;p&gt;&lt;b&gt;Start Date: &lt;/b&gt;&lt;%#Eval("StartDate")%&gt;, Expiry Date: &lt;%#Eval("ExpiryDate")%&gt;&lt;/p&gt; &lt;p&gt;&lt;b&gt;Security Digits: &lt;/b&gt;&lt;%#Eval("SecurityDigits")%&gt;&lt;/p&gt; &lt;h4&gt;Ordered items:&lt;/h4&gt; &lt;asp:Repeater ID="Repeater2" runat="server" DataSourceID="AccessDataSource2"&gt; &lt;ItemTemplate&gt; &lt;div style="display: block; float: left;"&gt; &lt;div class="viewAllOrdersProductImage"&gt; &lt;img width="70px" height="70px" alt="&lt;%# Eval("Artist") %&gt; - &lt;%# Eval("Album") %&gt;" src="assets/images/thumbs/&lt;%# Eval("ImageURL") %&gt;" /&gt; &lt;/div&gt; &lt;div style="display:block; float:left; padding-top:15px; padding-right:20px;"&gt;&lt;p&gt;&lt;b&gt;&lt;%# Eval("Artist") %&gt; - &lt;%# Eval("Album") %&gt;&lt;/b&gt;&lt;/p&gt; &lt;p&gt;£&lt;%# Eval("Cost") %&gt; x &lt;%# Eval("Quantity") %&gt; = £&lt;%#Eval("Total")%&gt;&lt;/p&gt;&lt;/div&gt; &lt;/div&gt; &lt;/ItemTemplate&gt; &lt;/asp:Repeater&gt; &lt;/div&gt; &lt;/div&gt; &lt;/ItemTemplate&gt; &lt;/asp:Repeater&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.
 

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