Link to home
Start Free TrialLog in
Avatar of j_tipps
j_tipps

asked on

DateTime.Now.ToShortDateString() and smalldatetime c#

I'm haveing a problem updateing the smalldatetime column in SQL server 2000.
i'm using C# asp.net

The command string looks like
string UpdateString= "INSERT INTO RISK_SCR (DateSCR, IMP, PROB) VALUES (" + DateTime.Now.ToShortDateString() + ",3,4)";

The output of the string looks like
INSERT INTO RISK_SCR (DateSCR, IMP, PROB) VALUES (11/20/2004,3,4)

All good right??
I'm catching the sqlexception and it pass and it updated the DB ...BUT in the smalldatetime column DateSCR it is defaulting to 1/1/1900, the default if nothing is entered.

kinda of strange that it updates with out a problem but doesn't update the smalldatetime column.
ASKER CERTIFIED SOLUTION
Avatar of SashP
SashP

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of j_tipps
j_tipps

ASKER

haha thanks, how funny