Click here to Skip to main content
13,191,877 members (31,045 online)
Rate this:
 
Please Sign up or sign in to vote.
See more:
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 2:56am
Updated 27-Dec-12 3: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!
:)
  Permalink  
v3

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

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy |
Web04 | 2.8.171017.2 | Last Updated 27 Dec 2012
Copyright © CodeProject, 1999-2017
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