Click here to Skip to main content
15,888,142 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Sql database ,asp.net(c#)

I have two table

1 Session1

ItemName Quantity Price Date
..................................
Onion 22 30 12/06/2012
salt 2 15 12/06/2012
egg 13 43 12/06/2012
chilly 12 88 12/06/2012
maida 6 77 13/06/2012
oil 7 227 12/06/2012
nuts 1 300 13/06/2012


2 Product

Product Quantity Price Date
...........................................
Puffs 22 120 12/06/2012
porotta 35 350 13/06/2012

I want to retrieve this data to my datagridview like in a different manner just see below

ITEMNAME QUANTITY PRICE DATE PRODUCT QUANTITY PRICE DATE
..............................................................................
Onion 22 30 12/06/2012 Puffs 22 120 12/06/2012
salt 2 15 12/06/2012
egg 13 43 12/06/2012
chilly 12 88 12/06/2012
oil 7 227 12/06/2012
...............................................................................
maida 6 77 13/06/2012 porotta 35 350 13/06/2012
nuts 1 300 13/06/2012
Posted
Updated 5-Dec-12 17:59pm
v2
Comments
choudhary.sumit 6-Dec-12 0:00am    
gimme your "select" query, which u r using to fetch data.
ravuravu 6-Dec-12 0:03am    
Sorry i Have no idea I am fresher Am just using some queries but its not working like this manner
ravuravu 6-Dec-12 0:05am    
string date = Calendar1.SelectedDate.ToShortDateString();
DateTime dt1 = DateTime.Parse(date.ToString());
string dt = dt1.ToString("MM/dd/yyyy");
string ss = "SELECT Session1.ItemName,Session1.Quantity,Session1.Price,Session1.Date,Product.Product,Product.Quantity,Product.Price,Product.Date from Session1,Product where Date='"+dt+"' ";
SqlDataAdapter madp4 = new SqlDataAdapter(ss, DbConnection.mCon);
DataSet mds4 = new DataSet();
madp4.Fill(mds4);
GridView3.DataSource = mds4;
GridView3.DataBind();
choudhary.sumit 6-Dec-12 0:05am    
ok suppose you are using this query "select itemname,quantity,.... from mytable" just change your query with "select itemname as [ITEM NAME], quantity as [QUANTITY],... & so on from mytable"
choudhary.sumit 6-Dec-12 0:06am    
just use aliasing with every column you retrieved

I see you are using ASP.Net? Can you not set the headings to caps using a style sheet?
Something like this in your stylesheet:

table thead th {
text-transform: uppercase;
}

A nice table designer here: http://tablestyler.com/[^]
 
Share this answer
 
Comments
ravuravu 6-Dec-12 0:15am    
sir i need that i want to take data to grid in the order of date
and the remaining field should be blank thats am asking sir, sorry for confusing
ravuravu 6-Dec-12 0:16am    
i just showed that manner in my question u can find it at the end portion
 
Share this answer
 
Comments
ravuravu 6-Dec-12 1:34am    
sorry sir

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



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