Wrox Programmer Forums
|
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 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 August 1st, 2009, 08:25 AM
Authorized User
 
Join Date: Jun 2006
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
 
Old August 1st, 2009, 03:26 PM
Lee Dumond's Avatar
Wrox Author
 
Join Date: Jan 2008
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(); 
}





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





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