 |
| ASP.NET 3.5 Professionals If you are an experienced ASP.NET programmer, this is the forum for your 3.5 questions. Please also see the Visual Web Developer 2008 forum. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the ASP.NET 3.5 Professionals section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

April 17th, 2009, 09:31 PM
|
|
Friend of Wrox
|
|
Join Date: Sep 2007
Posts: 169
Thanks: 7
Thanked 2 Times in 2 Posts
|
|
Need Help with Convert SQL.
Hi
I am using a typed dataset and I using Convert to try to trim one of my datetimes to just date(I am using mssql2005).
So I have something like this in my sql query.
CONVERT(varchar, ExpiryDate, 101) AS ExpiryDate
Now when I run it in the query builder it trims it down to just the date but when I run it live it still has the time.
I am attaching it to a grdivew. So first I made a bound field:
BoundField endDate = new BoundField();
endDate.HeaderText = "Expiry Date";
endDate.DataField = "ExpiryDate";
Then I return a datatable from my 3 tier architecture and use this as the Datasource and then bind it but I keep getting it with the time included.
Did I do something wrong?
|
|

April 17th, 2009, 10:26 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
|
|
I don't remember how to do it, but add a format property to add format to the field.
__________________
HTH
Gonzalo
================================================== =========
Read this if you want to know how to get a correct reply for your question.
(Took that from Doug signature and he Took that from Peter profile)
================================================== =========
My programs achieved a new certification :
WORKS ON MY MACHINE
================================================== =========
I know that CVS was evil, and now i got the proof.
================================================== =========
|
|

April 18th, 2009, 12:26 AM
|
|
Friend of Wrox
|
|
Join Date: Sep 2007
Posts: 169
Thanks: 7
Thanked 2 Times in 2 Posts
|
|
ff
Quote:
Originally Posted by gbianchi
I don't remember how to do it, but add a format property to add format to the field.
|
format property?
|
|

April 18th, 2009, 12:30 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
|
|
Sorry my mistake, I was thinking directly in the field in the grid. It has a format property. At any point, someone is changing how your data is showed, and that is probably the grid. All the times are equal or you see the correct time in the grid???
__________________
HTH
Gonzalo
================================================== =========
Read this if you want to know how to get a correct reply for your question.
(Took that from Doug signature and he Took that from Peter profile)
================================================== =========
My programs achieved a new certification :
WORKS ON MY MACHINE
================================================== =========
I know that CVS was evil, and now i got the proof.
================================================== =========
|
|

April 18th, 2009, 01:23 AM
|
|
Friend of Wrox
|
|
Join Date: Sep 2007
Posts: 169
Thanks: 7
Thanked 2 Times in 2 Posts
|
|
Quote:
Originally Posted by gbianchi
Sorry my mistake, I was thinking directly in the field in the grid. It has a format property. At any point, someone is changing how your data is showed, and that is probably the grid. All the times are equal or you see the correct time in the grid???
|
Yep it seems to be correct just has the time with it that I don't want.
|
|

April 18th, 2009, 08:18 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
|
|
And if you take out the convert from the query, it shows the same values??? this is weird, unless you are not using the SQL you think you are using.
__________________
HTH
Gonzalo
================================================== =========
Read this if you want to know how to get a correct reply for your question.
(Took that from Doug signature and he Took that from Peter profile)
================================================== =========
My programs achieved a new certification :
WORKS ON MY MACHINE
================================================== =========
I know that CVS was evil, and now i got the proof.
================================================== =========
|
|

April 18th, 2009, 01:58 PM
|
|
Friend of Wrox
|
|
Join Date: Sep 2007
Posts: 169
Thanks: 7
Thanked 2 Times in 2 Posts
|
|
Quote:
Originally Posted by gbianchi
And if you take out the convert from the query, it shows the same values??? this is weird, unless you are not using the SQL you think you are using.
|
Yep. Only time it changes is in the preview window of the sql query builder.
|
|
 |