Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 ASP.NET
 update database with DateTime d1=(DateTime)myComm

Author  Topic 

ying
Starting Member

4 Posts

Posted - 2004-05-13 : 23:17:56
TimeSpan d3;

DateTime d1=DateTime.Parse(myCommand.Parameters["@endtime"].Value);
DateTime d2=(DateTime)myCommand.Parameters["@startime"].Value;
d3=d1.Subtract(d2);
myCommand.Parameters["@startime"].Value=d3.Days.ToString()+"days"+d3.Hours.ToString()+"hours"+d3.Minutes.ToString()+"minutes";

CS1502: Óë¡°System.DateTime.Parse(string)¡±×îÆ¥ÅäµÄÖØÔØ·½·¨¾ßÓÐһЩÎÞЧ²ÎÊý



gave me a way to this problem

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2004-05-14 : 13:41:43
What's your question and can you translate the last part?

Tara
Go to Top of Page

vganesh76
Yak Posting Veteran

64 Posts

Posted - 2004-05-26 : 00:02:02
what is the type of the parameter @startime. if it is datetime then u can directly assign the value as


myCommand.Parameters["@startime"].Value= d1.Subtract(d2);

Enjoy working
Go to Top of Page

byrmol
Shed Building SQL Farmer

1591 Posts

Posted - 2004-05-26 : 00:06:56
Be careful with the Add and Subtract methods on DateTime.. They break a basic programming convention of returning different types.. Pass in a TimeSpan get a DateTime.. Pass in a Datetime get a TimeSpan...


DavidM

"Always pre-heat the oven"
Go to Top of Page
   

- Advertisement -