Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Feb 15, 2012 12:45 AM by Decker Dong - MSFT
Feb 13, 2012 06:10 PM|LINK
I am trying to select an order from the database and then get that order's details. I have a table with all the orders (order #) in it and there is one row/record per order. THen I have another table I am joining to, bu order #, with the order's details.
I want to use that with a CollapsablePanel extender, by showing the details when you click on that record. The problem is: when I do the join, I obviously get a bunch of records that come back, but the I only want to use the order number, first name, last
name et cetera to show up ONCE in the "HeaderPanel" of the collapsable extender. HOw would I go about doing something like this?
Feb 13, 2012 06:24 PM|LINK
For the fields that you only want to appear once, use the data from the first row of your query results.
Feb 13, 2012 09:36 PM|LINK
use "Distinct" word in your sql query and see if that helps...
select distinct OrderNumber, FirstName, LastName...
Feb 15, 2012 12:45 AM|LINK
but the I only want to use the order number, first name, last name et cetera to show up ONCE in the "HeaderPanel"
Besides using distinct，you can also use DataView.ToTable's 3rd function with a string，this will filter duplicated issues……
using(SqlDataAdapter adapter = new SqlDataAdapter("select * ……","conn str"))
DataTable dt = new DataTable();
DataView dv = new DataView(dt);
dt = dv.ToTable(true,"field1","field2",……,"fieldN");