Wrox Programmer Forums
|
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
 
Old April 17th, 2009, 09:31 PM
Friend of Wrox
 
Join Date: Sep 2007
Posts: 169
Thanks: 7
Thanked 2 Times in 2 Posts
Default 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?
 
Old April 17th, 2009, 10:26 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

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.
================================================== =========
 
Old April 18th, 2009, 12:26 AM
Friend of Wrox
 
Join Date: Sep 2007
Posts: 169
Thanks: 7
Thanked 2 Times in 2 Posts
Default

ff
Quote:
Originally Posted by gbianchi View Post
I don't remember how to do it, but add a format property to add format to the field.
format property?
 
Old April 18th, 2009, 12:30 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

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.
================================================== =========
 
Old April 18th, 2009, 01:23 AM
Friend of Wrox
 
Join Date: Sep 2007
Posts: 169
Thanks: 7
Thanked 2 Times in 2 Posts
Default

Quote:
Originally Posted by gbianchi View Post
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.
 
Old April 18th, 2009, 08:18 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

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.
================================================== =========
 
Old April 18th, 2009, 01:58 PM
Friend of Wrox
 
Join Date: Sep 2007
Posts: 169
Thanks: 7
Thanked 2 Times in 2 Posts
Default

Quote:
Originally Posted by gbianchi View Post
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.





Similar Threads
Thread Thread Starter Forum Replies Last Post
convert a SQL Statement from MS Access to a SQL Corey Access 6 March 28th, 2007 12:33 PM
convert rdl to sql tragates Reporting Services 3 August 10th, 2006 12:06 PM
How to convert rdl to sql tragates Crystal Reports 0 August 8th, 2006 07:48 AM
How to convert XML into SQL wollongong Classic ASP Databases 1 December 22nd, 2004 01:56 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.