Click here to Skip to main content
15,883,709 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i'm using repeaters to show data in webform. but i have a problem with this code. when i select * data from BidTAble it shows in Desc order but when i use INNER JOIN , Desc doesn't work.! :/

What I have tried:

ASP.NET
 <asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:CONN %>" SelectCommand="SELECT BidTable.BidID,BidTable.RegID,BidTable.CarID,Reg.username,BidTable.BidAmount  FROM [BidTable] INNER JOIN Reg ON BidTable.RegID=Reg.ID  WHERE ([CarID] = @CarID) ORDER BY [BidAmount] DESC">
         <SelectParameters>
                <asp:QueryStringParameter Name="CarID" 

QueryStringField="id" Type="Int32" />
            </SelectParameters>

        </asp:SqlDataSource>
Posted
Updated 30-Aug-17 1:11am
v2
Comments
[no name] 25-Aug-17 0:30am    
Did you try using the full qualified Name BidTable.BidAmount in the ORDER BY?

1 solution

Hi..

Specify TableName.ColumnName in WHERE clause.

SELECT BidTable.BidID,BidTable.RegID,BidTable.CarID,Reg.username,BidTable.BidAmount  FROM [BidTable] INNER JOIN Reg ON BidTable.RegID=Reg.ID  WHERE (BidTable.CarID = @CarID) ORDER BY BidTable.BidAmount DESC
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900