Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#
I inserted all the records in the database.
 
database type as
DOB             datetime
Wedding day     datetime
I have a button view and when I click that button all records should be displayed in the Grid View.
 
Grid view Button code as follows:
SQL
Sql = "select Name,DOB,Mobileno,Weddingday,Email from BIrthDayWish where Active = 'A' ORDER BY Name";
        Dr = SCon.ReadSql(Sql);
        GridView1.DataSource = Dr;
        GridView1.DataBind();
        GridView1.Visible = true;
output in Grid View as follows
Name        DOB               Mobile no        Wedding day               Email
ram       22/12/1986          9945598565       22/12/2009            ram@gm.com
But I would like the output in the grid view related to DOB and Wedding day date month to be shown as in char (Jan,Feb like that)
DOB           Wedding
22/12/1986    22/12/2009 (I don't want like)
I want it as
DOB           Wedding
22/dec/1986    22/dec/2009 (I want like)
Name        DOB               Mobile no        Wedding day               Email
ram        22/dec/1986        9945598565        22/dec/2009            ram@gm.com
SQL
Sql = "select Name,DOB,Mobileno,Weddingday,Email from BIrthDayWish where Active = 'A' ORDER BY Name"
From my above query how to correct the query and get the output as follows
Name    DOB           Mobile no     Wedding day       Email
ram    22/dec/1986    9945598565     22/dec/2009    ram@gm.com
Posted 27-Dec-12 3:56am
Edited 27-Dec-12 4:23am
v3

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

this way...
SELECT replace(convert(varchar(11), getdate(), 113),' ', '/')
or
SELECT replace(CONVERT(VARCHAR(11), GETDATE(), 106),' ', '/')
Happy Coding!
Smile | :)
  Permalink  
v3

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

  Print Answers RSS
0 OriginalGriff 277
1 Maciej Los 210
2 BillWoodruff 205
3 DamithSL 165
4 Tomas Takac 144
0 OriginalGriff 5,130
1 DamithSL 4,157
2 Maciej Los 3,670
3 Kornfeld Eliyahu Peter 3,470
4 Sergey Alexandrovich Kryukov 2,821


Advertise | Privacy | Mobile
Web04 | 2.8.141216.1 | Last Updated 27 Dec 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100