p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


Go Back   p2p.wrox.com Forums > ASP.NET and ASP > ASP.NET 3.5 > ASP.NET 3.5 Professionals
I forgot my password Register Now
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 p2p Programmer to Programmer discussion community. This is a community of more than 40,000 computer programmers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining our free Wrox p2p community you can post your own programming questions and respond to other programmers’ questions. Registered users also don't have to see the ads that are displayed to guests. Registration is fast, simple and absolutely free so please, join today!
Join today and post to win prizes! Post more to increase your chances of being Wrox’s top poster of the month.

Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old April 17th, 2009, 10:31 PM
Friend of Wrox
Points: 763, Level: 10
Points: 763, Level: 10 Points: 763, Level: 10 Points: 763, Level: 10
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Sep 2007
Location: , , .
Posts: 167
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?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #2 (permalink)  
Old April 17th, 2009, 11:26 PM
Friend of Wrox
Points: 6,551, Level: 34
Points: 6,551, Level: 34 Points: 6,551, Level: 34 Points: 6,551, Level: 34
Activity: 31%
Activity: 31% Activity: 31% Activity: 31%
 
Join Date: Jun 2003
Location: Capital Federal, , Argentina.
Posts: 1,994
Thanks: 5
Thanked 37 Times in 36 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.
================================================== =========
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #3 (permalink)  
Old April 18th, 2009, 01:26 AM
Friend of Wrox
Points: 763, Level: 10
Points: 763, Level: 10 Points: 763, Level: 10 Points: 763, Level: 10
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Sep 2007
Location: , , .
Posts: 167
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?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #4 (permalink)  
Old April 18th, 2009, 01:30 AM
Friend of Wrox
Points: 6,551, Level: 34
Points: 6,551, Level: 34 Points: 6,551, Level: 34 Points: 6,551, Level: 34
Activity: 31%
Activity: 31% Activity: 31% Activity: 31%
 
Join Date: Jun 2003
Location: Capital Federal, , Argentina.
Posts: 1,994
Thanks: 5
Thanked 37 Times in 36 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.
================================================== =========
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #5 (permalink)  
Old April 18th, 2009, 02:23 AM
Friend of Wrox
Points: 763, Level: 10
Points: 763, Level: 10 Points: 763, Level: 10 Points: 763, Level: 10
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Sep 2007
Location: , , .
Posts: 167
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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #6 (permalink)  
Old April 18th, 2009, 09:18 AM
Friend of Wrox
Points: 6,551, Level: 34
Points: 6,551, Level: 34 Points: 6,551, Level: 34 Points: 6,551, Level: 34
Activity: 31%
Activity: 31% Activity: 31% Activity: 31%
 
Join Date: Jun 2003
Location: Capital Federal, , Argentina.
Posts: 1,994
Thanks: 5
Thanked 37 Times in 36 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.
================================================== =========
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #7 (permalink)  
Old April 18th, 2009, 02:58 PM
Friend of Wrox
Points: 763, Level: 10
Points: 763, Level: 10 Points: 763, Level: 10 Points: 763, Level: 10
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Sep 2007
Location: , , .
Posts: 167
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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Reply


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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off
Forum Jump

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 01:33 PM
convert rdl to sql tragates Reporting Services 3 August 10th, 2006 01:06 PM
How to convert rdl to sql tragates Crystal Reports 0 August 8th, 2006 08:48 AM
convert SQL express to SQL for website bobbyastrain BOOK: Wrox's SQL Server 2005 Express Edition Starter Kit ISBN: 978-0-7645-8923-2 0 August 6th, 2006 09:22 PM
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 02:12 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
© 2008 Wiley Publishing, Inc