J
James
Hello,
Im having trouble getting information on how to use dates. I have a FormView
and a AccessDataSource. The Insert command needs to insert the current date
into one field and a date 1 year from the current date into another
(registration date and expiry date).
Searching online I can find GETDATE() and DATEADD() neither seem to work. It
works fine if I use NOW() or manual type the dates in, but NOW() puts in time
which I do not want.
My code is below:
<asp:AccessDataSource runat=server ID="ADS2" DataFile="~/App_Data/data.mdb"
InsertCommand="INSERT INTO table([regnumber], firstname, lastname, telephone,
email, enroldate, expiry, address1, address2, address3, county, postcode)
VALUES (2, ?, ?, ?, ?, GETDATE(), DATEADD(year,1,GETDATE()), ?, ?, ?, ?, ?)" >
Any help would be great thanks
James
Im having trouble getting information on how to use dates. I have a FormView
and a AccessDataSource. The Insert command needs to insert the current date
into one field and a date 1 year from the current date into another
(registration date and expiry date).
Searching online I can find GETDATE() and DATEADD() neither seem to work. It
works fine if I use NOW() or manual type the dates in, but NOW() puts in time
which I do not want.
My code is below:
<asp:AccessDataSource runat=server ID="ADS2" DataFile="~/App_Data/data.mdb"
InsertCommand="INSERT INTO table([regnumber], firstname, lastname, telephone,
email, enroldate, expiry, address1, address2, address3, county, postcode)
VALUES (2, ?, ?, ?, ?, GETDATE(), DATEADD(year,1,GETDATE()), ?, ?, ?, ?, ?)" >
Any help would be great thanks
James