Using VB.Net and SQL 2005
Table1
Name FromDate ToDate
Sched1 20091201 20091231
Sched2 20090515 20090613
...,
In table2 i want to add a time for a date between the FromDate and ToDate
Table2
Name Date StartTime EndTime
Sched1 20091201 080000 120000
...,
In my application am using "AddTime" Button. In the click event i want to write a code for adding the time for the dates.
When I click ADDTime Button. It should check the max(date) in table2. Then it should show the next date of the max(date) in table2.
For Example
Select max(date) from table where name = 'Sched1'.
It should show the next date means 20091202. because 20091201 Data is there.
There is no data in table2 for Sched2, So It should show the StartDate 20090515 from table1.
How to make a code or query for this condition?
Can any one give me a idea or samples for the above condition.