PDA

Click to See Complete Forum and Search --> : Easiest .asp question ever..... probably


artsapimp
Aug 17th, 2000, 02:17 PM
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...


...
<td>Opened Date&nbsp;</td>
<td><%= Date%></td>
</tr>
<tr>
<td>Opened Time&nbsp;</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.


...
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

parksie
Aug 17th, 2000, 02:20 PM
You have rst("OpnedTime")...try rst("OpenedTime").

artsapimp
Aug 17th, 2000, 02:41 PM
I'm sorry. This was retyped while I was posting this. the actual page does have opened on it, not opned.

parksie
Aug 17th, 2000, 02:44 PM
That's okay. How about your field definitions? Are they compatible with setting the time?

artsapimp
Aug 17th, 2000, 02:47 PM
Thank you very much. That was it. The Date was set right, but Time was set to TEXT. Thanks again.

artsapimp
Aug 17th, 2000, 02:59 PM
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.

parksie
Aug 17th, 2000, 03:04 PM
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.

artsapimp
Aug 17th, 2000, 04:20 PM
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-

<form action="submit.asp" method="post">
Date Opened:&nbsp;<%= Date%><br>
Time Opened:&nbsp;<%= Time%><br>
<input type="submit" value="Submit">
</form>


submit.asp-

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.

artsapimp
Aug 17th, 2000, 06:22 PM
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...


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.

parksie
Aug 18th, 2000, 12:31 PM
Don't worry...I don't have any time to waste :).