0

I have a form page on the web using a FormView. There are a half dozen fields for the user to fill or select from drop downs. These get populated into the sql database with the standard sqldatasource insert statement.

However, I also want to add the current date and time and the username to the database using the same insert statement.

I only seem to be able to get it to work if the user enters the info. I want to enter programmatic info. I already have a variable defined in the aspx page that displays
(DateTime DTGNewOpened = DateTime.Now;
Response.Write(DTGNewOpened);)
I would like to have the data within the DTGNewOpened variable added to the datetime filed in the database.

I don't think I should have to do an code behind for anything this elementary, but it is driving me crazy.

Any ideas would be appreciated.

thanks,
crb

3
Contributors
2
Replies
3
Views
11 Years
Discussion Span
Last Post by Paladine
0

Of course you have to write code-behind. Where else would code go? Surely you're not mixing your code and HTML together in the ASPX page?

Simply modify your INSERT query itself.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.