Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 3.5 > ASP.NET 3.5 Professionals
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old April 17th, 2009, 09:31 PM
Friend of Wrox
 
Join Date: Sep 2007
Location: , , .
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?
  #2 (permalink)  
Old April 17th, 2009, 10:26 PM
Friend of Wrox
Points: 7,395, Level: 36
Points: 7,395, Level: 36 Points: 7,395, Level: 36 Points: 7,395, Level: 36
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Capital Federal, , Argentina.
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.
================================================== =========
  #3 (permalink)  
Old April 18th, 2009, 12:26 AM
Friend of Wrox
 
Join Date: Sep 2007
Location: , , .
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?
  #4 (permalink)  
Old April 18th, 2009, 12:30 AM
Friend of Wrox
Points: 7,395, Level: 36
Points: 7,395, Level: 36 Points: 7,395, Level: 36 Points: 7,395, Level: 36
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Capital Federal, , Argentina.
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.
================================================== =========
  #5 (permalink)  
Old April 18th, 2009, 01:23 AM
Friend of Wrox
 
Join Date: Sep 2007
Location: , , .
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.
  #6 (permalink)  
Old April 18th, 2009, 08:18 AM
Friend of Wrox
Points: 7,395, Level: 36
Points: 7,395, Level: 36 Points: 7,395, Level: 36 Points: 7,395, Level: 36
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Capital Federal, , Argentina.
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.
================================================== =========
  #7 (permalink)  
Old April 18th, 2009, 01:58 PM
Friend of Wrox
 
Join Date: Sep 2007
Location: , , .
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.
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 04:49 PM.


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