-
I know this is easy but it's really driving me crazy.
I am trying to log the time and date a form is being submitted into a database along with all of the information on the form. I don't want the person filling out the form to be able to change the time and date which is why I have it done like this...
Code:
...
<td>Opened Date </td>
<td><%= Date%></td>
</tr>
<tr>
<td>Opened Time </td>
<td><%= Time%></td>
</tr>
...
This part is working fine. But when I'm trying to save it to a database it's not saving the time, but is saving the date. Here is my code I'm using for that.
Code:
...
rst("OpenedDate") = Date
rst("OpnedTime") = Time
...
I know it's not pulling that from the form but if it's a minute or two off it won't really matter. The date is populating but the time isn't.
Please help. Thanks
-
You have rst("OpnedTime")...try rst("OpenedTime").
-
sorry
I'm sorry. This was retyped while I was posting this. the actual page does have opened on it, not opned.
-
That's okay. How about your field definitions? Are they compatible with setting the time?
-
PERFECT!
Thank you very much. That was it. The Date was set right, but Time was set to TEXT. Thanks again.
-
Sorry again
It seems I have jumped to an incorrect conclusion. It still isn't working. The form is right, the submit.asp is right. I am stumped.... again.
-
If it is not absolutely necessary to have them as searchable date/time values, use text fields and convert the date/time into a string using the Format function. Other than that, I'd have to see some of your code.
-
I'm sorry but I don't really know what you mean by the format function. If you could expand a little more I'd appreciate it.
Here is some of my code....
default.asp-
Code:
<form action="submit.asp" method="post">
Date Opened: <%= Date%><br>
Time Opened: <%= Time%><br>
<input type="submit" value="Submit">
</form>
submit.asp-
Code:
Dim cnn
Dim rst
Dim ConnectString
...
...
rst.Addnew
rst("OpenedDate") = Date
rst("OpenedTime") = Time
rst.Update
rst.Movenext
rst.Close
I'm not sure if this is going to help you, but that's about what I've got.
-
That was easy....
Sorry but noone here had a chance at this one. Once looking it over with a new pair of eyes it seems the code was written 2x like this...
Code:
rst.addnew
rst("OpenedDate") = Date
rst("OpenedTime") = Time
...
rst("OpenedTime") = Request.Form("OpenedTime")
...
I'm sorry to waste your time. Thanks for the help though.
-
Don't worry...I don't have any time to waste :).