February 23, 2008 at 11:53 am
Hi to all
i am new to vb.net and for lerning purpose i am developing a software.while i am working with MS SQL2005 i have the following problem...please help me to learn
(1) When i am trying to insert Current Date from Code into MS SQL2005 than it always store 1/1/1900 however when i'ts value must be as my System's Date.
(2) How to calculate Date Difference( i know the DateDIff function) in my Application i.e. i have two field FromDate and toDate(both datetime datatype). now i want to know that if the range lie's between current Date from vb.net code.
(3) i also want to know that how do i calculate total no. of days from database(in above(2) table).
Please give me any code example or any thing that help me :hehe:.
thanks in advance.
February 23, 2008 at 5:17 pm
Any code samples?
February 23, 2008 at 8:47 pm
1. My guess is that your code is passing either an empty string ('') or a zero as the value, either of which get converted to 1/1/1900 when cast to a datetime in MSSQL
2. I don't know a lot of VB.net, I usually use C#, but I did find this page that uses a timespan object to calculate the difference between "now" and a date: http://www.go4expert.com/forums/showthread.php?t=3609
3. There is a DateDiff in MSSQL: SELECT DATEDIFF(day, date1, date2)
Good Luck!
Chad
February 24, 2008 at 12:05 am
Thanks for attention . i have solved the problem by changing datetime field in MSSQL to smalldate.now every thing is fine.
however thanks a lot..:w00t:
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply