|
 |
asp_web_howto thread: Break up a string into 3 variables that has been called from a database field
Message #1 by "Anna Knippel" <ak2u@y...> on Fri, 26 Jul 2002 01:42:34
|
|
Hi.
Right now I have a form that has 3 drop down menus to collect the Start
time of a reservation. The reason I have it broken up is because I have
to add 30 minutes to the starting time of the reservation and then send
it to my database. However, when the user goes to edit an entry that has
been selected from the database the drop down time currently default to
1 00 AM. How can I get the drop down menus to read the time in the
database? The database has one field called Start Time in which my
contatenated variables were sent to (hour + minute + AM/PM). I've read
that in C ++ you can use delimiting characters to break up a string, but
I haven't found a way to do this with ASP.
Thanks for the help,
Anna
Message #2 by "Ken Schaefer" <ken@a...> on Fri, 26 Jul 2002 10:55:56 +1000
|
|
Are you storing the time in a date/time field?
If so, then you could use Hour() and Minute() to get the appropriate values.
Then use the conditional VBScript to work out which <option> needs the extra
"selected" text written in.
dteStartTime = objRS("StartTime")
dteStartHour = Hour(dteStartTime)
dteStartMinute = Minute(dteStartTime)
Cheers
Ken
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: "Anna Knippel" <ak2u@y...>
Subject: [asp_web_howto] Break up a string into 3 variables that has been
called from a database field
: Hi.
:
: Right now I have a form that has 3 drop down menus to collect the Start
: time of a reservation. The reason I have it broken up is because I have
: to add 30 minutes to the starting time of the reservation and then send
: it to my database. However, when the user goes to edit an entry that has
: been selected from the database the drop down time currently default to
: 1 00 AM. How can I get the drop down menus to read the time in the
: database? The database has one field called Start Time in which my
: contatenated variables were sent to (hour + minute + AM/PM). I've read
: that in C ++ you can use delimiting characters to break up a string, but
: I haven't found a way to do this with ASP.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Message #3 by "Scott Dempsey" <scottd@c...> on Fri, 26 Jul 2002 00:02:18 -0700
|
|
Hi Anna,
In the event the data is stored a string, why not just parse out the
string, using the colon(:) as your control character. Use the Mid()
function to select the characters to left for the HOUR, use the same
function to select the two characters to the right for the MINUTES.
Scott Dempsey
-----Original Message-----
From: Anna Knippel [mailto:ak2u@y...]
Sent: Friday, July 26, 2002 1:43 AM
To: ASP Web HowTo
Subject: [asp_web_howto] Break up a string into 3 variables that has
been called from a database field
Hi.
Right now I have a form that has 3 drop down menus to collect the Start
time of a reservation. The reason I have it broken up is because I have
to add 30 minutes to the starting time of the reservation and then send
it to my database. However, when the user goes to edit an entry that
has
been selected from the database the drop down time currently default to
1 00 AM. How can I get the drop down menus to read the time in the
database? The database has one field called Start Time in which my
contatenated variables were sent to (hour + minute + AM/PM). I've read
that in C ++ you can use delimiting characters to break up a string, but
I haven't found a way to do this with ASP.
Thanks for the help,
Anna
---
Improve your web design skills with these new books from Glasshaus.
Usable Web Menus
http://www.amazon.com/exec/obidos/ASIN/1904151027/ref=nosim/theprogramme
r-20
Constructing Accessible Web Sites
http://www.amazon.com/exec/obidos/ASIN/1904151000/ref=nosim/theprogramme
r-20
Practical JavaScript for the Usable Web
http://www.amazon.com/exec/obidos/ASIN/1904151051/ref=nosim/theprogramme
r-20
Message #4 by "Craig Flannigan" <ckf@k...> on Fri, 26 Jul 2002 08:13:32 +0100
|
|
Just a thought....
If you're not storing it as a date/time in your DB, then you could always
split the field providing you have some form of delimiter.
If you saved the time as 12:30:00 in your Database, in a text field (not
date/time) then you could do:
arrTime = Split( YourDBFieldHere, ":")
this means that arrTime(0) would be the hour, arrTime(1) would be the
minutes, and arrTime(2) would be the seconds.
Regards
Craig.
-----Original Message-----
From: Anna Knippel [mailto:ak2u@y...]
Sent: 26 July 2002 01:43
To: ASP Web HowTo
Subject: [asp_web_howto] Break up a string into 3 variables that has
been called from a database field
Hi.
Right now I have a form that has 3 drop down menus to collect the Start
time of a reservation. The reason I have it broken up is because I have
to add 30 minutes to the starting time of the reservation and then send
it to my database. However, when the user goes to edit an entry that has
been selected from the database the drop down time currently default to
1 00 AM. How can I get the drop down menus to read the time in the
database? The database has one field called Start Time in which my
contatenated variables were sent to (hour + minute + AM/PM). I've read
that in C ++ you can use delimiting characters to break up a string, but
I haven't found a way to do this with ASP.
Thanks for the help,
Anna
---
Improve your web design skills with these new books from Glasshaus.
Usable Web Menus
http://www.amazon.com/exec/obidos/ASIN/1904151027/ref=nosim/theprogramme
r-20
Constructing Accessible Web Sites
http://www.amazon.com/exec/obidos/ASIN/1904151000/ref=nosim/theprogramme
r-20
Practical JavaScript for the Usable Web
http://www.amazon.com/exec/obidos/ASIN/1904151051/ref=nosim/theprogramme
r-20
_____________________________________________________________________
This message has been checked for all known viruses by Star Internet
delivered through the MessageLabs Virus Scanning Service on behalf of
Kingfield Heath Ltd. For further information visit
http://www.star.net.uk/stats.asp
_____________________________________________________________________
This message has been checked for all known viruses by Star Internet
delivered through the MessageLabs Virus Scanning Service on behalf of Kingfield Heath Ltd. For further information visit
http://www.star.net.uk/stats.asp
|
|
 |