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 Basics
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
ASP.NET 3.5 Basics If you are new to ASP or ASP.NET programming with version 3.5, this is the forum to begin asking 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 Basics 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 August 1st, 2009, 08:25 AM
Authorized User
Points: 493, Level: 7
Points: 493, Level: 7 Points: 493, Level: 7 Points: 493, Level: 7
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2006
Location: gandhinagar, gujarat, India.
Posts: 88
Thanks: 0
Thanked 0 Times in 0 Posts
Default Updation Problem

Hi all

I am writing one update query in c#

cmd.CommandText = "Update dbo.drycleaner_customercoupon_status set coupon_date=" + DateTime.Today.ToShortDateString() + ",coupon_status='" + status + "' where customer_name='" + Session["cust_name"] + "' " + " and " + " coupon_code='" + Session["codetype"] + "'";

This query runs perfect but store in database as "1/1/1900 12:00:00 AM".it's wrong date becoz i store today's date.

what is actual problem i am not getting.
Pls hepl me

Thanks
  #2 (permalink)  
Old August 1st, 2009, 03:26 PM
Lee Dumond's Avatar
Wrox Author
Points: 4,942, Level: 29
Points: 4,942, Level: 29 Points: 4,942, Level: 29 Points: 4,942, Level: 29
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2008
Location: Decatur, IL, USA.
Posts: 923
Thanks: 12
Thanked 166 Times in 162 Posts
Default

Sounds like you could be having a culture issue where SQL Server does not understand the date format being provided by DateTime.Today.ToShortDateString().

You might consider trying DateTime.Today.ToString(CultureInfo.InvariantCulture) instead.
__________________
Visit my blog at http://leedumond.com
Follow me on Twitter: http://twitter.com/LeeDumond

Code:
if (this.PostHelpedYou)
{
   ClickThanksButton(); 
}
 


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
help in updation sanjeev jha Classic ASP Basics 0 November 12th, 2007 04:17 AM
Problem in Updation. rupen Classic ASP Basics 5 June 27th, 2005 07:17 PM
Problem in updation abhit_kumar JSP Basics 3 November 30th, 2004 09:47 AM
updation problem abhit_kumar Java Databases 0 November 25th, 2004 01:45 AM
updation problem abhit_kumar Pro JSP 0 November 25th, 2004 01:44 AM



All times are GMT -4. The time now is 03:01 AM.


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