I'd like to take values between a date range and enter into a table

I have a date range @startdate and @enddate

i'd like my user to enter the date range and then for the system to take the date range entered and insert them into a table, however, my table only allows one date value i.e Dte

how do I take my @startdate and @enddate and make into @Dte?

Is that possible?

INSERT INTO tblA (dte,intID,RoomType,Qty,Price) VALUES (@dte,@ResortID,@RoomType,@Qty,@Price)

Any sort of advise or links would be appreciated

Recommended Answers

All 2 Replies

You could take timespan object by subtracting start date from end date. Now you would have "a single datetime value". But if you need to get back either start date or the end date from the timespan, you can't do it. In that case the only solution is to add another datefield to DB which shouldn't be hard.

HTH

Can't add a new datefield in db as I do not know what all places in code "select * from table" is being called but I'll try subtracting and see how that goes

Thanks for the heads up!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.