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?
donato1026
Member
225 Points
240 Posts
Select ONE record with details from that record...
Feb 13, 2012 06:10 PM|LINK
Hello,
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?
~D
Dan Bracuk
Contributor
3970 Points
1096 Posts
Re: Select ONE record with details from that record...
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.
rajsedhain
Contributor
4181 Points
1041 Posts
Re: Select ONE record with details from that record...
Feb 13, 2012 09:36 PM|LINK
use "Distinct" word in your sql query and see if that helps...
select distinct OrderNumber, FirstName, LastName...
Raj Sedhain
Decker Dong ...
All-Star
118619 Points
18779 Posts
Re: Select ONE record with details from that record...
Feb 15, 2012 12:45 AM|LINK
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(); adapter.Fill(dt); DataView dv = new DataView(dt); dt = dv.ToTable(true,"field1","field2",……,"fieldN"); }