|
 |
asp_web_howto thread: inStr
Message #1 by Jean Halstad <J_Halstad@S...> on Thu, 14 Mar 2002 09:29:30 -0000
|
|
Have written this:
if not instr(TB1, "0900-0930", 1) then .....
TB1 is a variable containing text
Am getting this error
Type mismatch: '[string: "0930-1000"]'
Have done a response.write, and sure enough the string is not being found,
although I know it is there.
What am I doing wrong?
*******SEAFOOD WEEK*******
4 to 11 October 2002
to register your interest contact us on
seafoodweek@s...
***************************************************************************
This e-mail and any files transmitted with it are confidential and intended
solely for the use of the individual or entity to whom they are addressed
If you have received this e-mail in error please notify
seafish@s...
If the content is not about the business of the Sea Fish Industry Authority
or the sea fish industry then the message is neither from nor sanctioned
by the Sea Fish Industry Authority.
Message #2 by "Craig Flannigan" <ckf@k...> on Thu, 14 Mar 2002 09:39:01 -0000
|
|
Use this...
Instr(StartFrom, TB1, "0900-0930",1)
Where StartFrom is a character number. For example, if you wished to search
your string 3 characters in from the left, you'd use '3'
If you're wanting to search from the beginning of the string, just enter 1.
Zero doesn't work.
---> If Instr(1, TB!, "0900-0930", 1) Then ...
HTH,
Craig.
-----Original Message-----
From: Jean Halstad [mailto:J_Halstad@S...]
Sent: 14 March 2002 09:30
To: ASP Web HowTo
Subject: [asp_web_howto] inStr
Have written this:
if not instr(TB1, "0900-0930", 1) then .....
TB1 is a variable containing text
Am getting this error
Type mismatch: '[string: "0930-1000"]'
Have done a response.write, and sure enough the string is not being found,
although I know it is there.
What am I doing wrong?
*******SEAFOOD WEEK*******
4 to 11 October 2002
to register your interest contact us on
seafoodweek@s...
***************************************************************************
This e-mail and any files transmitted with it are confidential and intended
solely for the use of the individual or entity to whom they are addressed
If you have received this e-mail in error please notify
seafish@s...
If the content is not about the business of the Sea Fish Industry Authority
or the sea fish industry then the message is neither from nor sanctioned
by the Sea Fish Industry Authority.
$subst('Email.Unsub').
_____________________________________________________________________
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
Message #3 by Jean Halstad <J_Halstad@S...> on Thu, 14 Mar 2002 09:50:09 -0000
|
|
Can't do that. All I know is the string might be in there somewhere amongst
other strings, so sometimes it will start from 1, sometimes from 10, etc.
The string I am searching for is always 9 characters long.
-----Original Message-----
From: Craig Flannigan [mailto:ckf@k...]
Sent: 14 March 2002 09:39
To: ASP Web HowTo
Subject: [asp_web_howto] RE: inStr
Use this...
Instr(StartFrom, TB1, "0900-0930",1)
Where StartFrom is a character number. For example, if you wished to search
your string 3 characters in from the left, you'd use '3'
If you're wanting to search from the beginning of the string, just enter 1.
Zero doesn't work.
---> If Instr(1, TB!, "0900-0930", 1) Then ...
HTH,
Craig.
-----Original Message-----
From: Jean Halstad [mailto:J_Halstad@S...]
Sent: 14 March 2002 09:30
To: ASP Web HowTo
Subject: [asp_web_howto] inStr
Have written this:
if not instr(TB1, "0900-0930", 1) then .....
TB1 is a variable containing text
Am getting this error
Type mismatch: '[string: "0930-1000"]'
Have done a response.write, and sure enough the string is not being found,
although I know it is there.
What am I doing wrong?
*******SEAFOOD WEEK*******
4 to 11 October 2002
to register your interest contact us on
seafoodweek@s...
***************************************************************************
This e-mail and any files transmitted with it are confidential and intended
solely for the use of the individual or entity to whom they are addressed
If you have received this e-mail in error please notify
seafish@s...
If the content is not about the business of the Sea Fish Industry Authority
or the sea fish industry then the message is neither from nor sanctioned
by the Sea Fish Industry Authority.
$subst('Email.Unsub').
_____________________________________________________________________
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
$subst('Email.Unsub').
*******SEAFOOD WEEK*******
4 to 11 October 2002
to register your interest contact us on
seafoodweek@s...
***************************************************************************
This e-mail and any files transmitted with it are confidential and intended
solely for the use of the individual or entity to whom they are addressed
If you have received this e-mail in error please notify
seafish@s...
If the content is not about the business of the Sea Fish Industry Authority
or the sea fish industry then the message is neither from nor sanctioned
by the Sea Fish Industry Authority.
Message #4 by Naresh Bobade <nareshbobade@y...> on Thu, 14 Mar 2002 02:08:08 -0800 (PST)
|
|
Hi Jean,
You cannot use a not with instr() function that's the
reason of your type-mismatch error.
Here's a code sample -
dim str1, str2
dim result
str1="0900-0930-004"
str2="0900-0930"
result=instr(str1,str2,1)
if result=0 then
response.write "str2 is not contained in str2"
else
response.write "str2 is contained in str2"
end if
you can use the above code and make changes of
variables accordingly in ur code. It'll be fine.
cheers,
NAresh
--- Jean Halstad <J_Halstad@S...> wrote:
> Have written this:
> if not instr(TB1, "0900-0930", 1) then .....
> TB1 is a variable containing text
> Am getting this error
> Type mismatch: '[string: "0930-1000"]'
> Have done a response.write, and sure enough the
> string is not being found,
> although I know it is there.
> What am I doing wrong?
>
> *******SEAFOOD WEEK*******
> 4 to 11 October 2002
> to register your interest contact us on
> seafoodweek@s...
>
>
***************************************************************************
> This e-mail and any files transmitted with it are
> confidential and intended
> solely for the use of the individual or entity to
> whom they are addressed
> If you have received this e-mail in error please
> notify
> seafish@s...
>
> If the content is not about the business of the Sea
> Fish Industry Authority
> or the sea fish industry then the message is neither
> from nor sanctioned
> by the Sea Fish Industry Authority.
>
__________________________________________________
Do You Yahoo!?
Yahoo! Sports - live college hoops coverage
http://sports.yahoo.com/
Message #5 by "Craig Flannigan" <ckf@k...> on Thu, 14 Mar 2002 10:02:34 -0000
|
|
By omitting the start character then it will always start from 1, but you
still need to place the comma there anyhow. You're telling Instr to start
from Character TB1.
---> Instr(,TB1, "0900-0930",1) for example would work better.
HTH
Craig.
-----Original Message-----
From: Jean Halstad [mailto:J_Halstad@S...]
Sent: 14 March 2002 09:50
To: ASP Web HowTo
Subject: [asp_web_howto] RE: inStr
Can't do that. All I know is the string might be in there somewhere amongst
other strings, so sometimes it will start from 1, sometimes from 10, etc.
The string I am searching for is always 9 characters long.
-----Original Message-----
From: Craig Flannigan [mailto:ckf@k...]
Sent: 14 March 2002 09:39
To: ASP Web HowTo
Subject: [asp_web_howto] RE: inStr
Use this...
Instr(StartFrom, TB1, "0900-0930",1)
Where StartFrom is a character number. For example, if you wished to search
your string 3 characters in from the left, you'd use '3'
If you're wanting to search from the beginning of the string, just enter 1.
Zero doesn't work.
---> If Instr(1, TB!, "0900-0930", 1) Then ...
HTH,
Craig.
-----Original Message-----
From: Jean Halstad [mailto:J_Halstad@S...]
Sent: 14 March 2002 09:30
To: ASP Web HowTo
Subject: [asp_web_howto] inStr
Have written this:
if not instr(TB1, "0900-0930", 1) then .....
TB1 is a variable containing text
Am getting this error
Type mismatch: '[string: "0930-1000"]'
Have done a response.write, and sure enough the string is not being found,
although I know it is there.
What am I doing wrong?
*******SEAFOOD WEEK*******
4 to 11 October 2002
to register your interest contact us on
seafoodweek@s...
***************************************************************************
This e-mail and any files transmitted with it are confidential and intended
solely for the use of the individual or entity to whom they are addressed
If you have received this e-mail in error please notify
seafish@s...
If the content is not about the business of the Sea Fish Industry Authority
or the sea fish industry then the message is neither from nor sanctioned
by the Sea Fish Industry Authority.
_____________________________________________________________________
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
*******SEAFOOD WEEK*******
4 to 11 October 2002
to register your interest contact us on
seafoodweek@s...
***************************************************************************
This e-mail and any files transmitted with it are confidential and intended
solely for the use of the individual or entity to whom they are addressed
If you have received this e-mail in error please notify
seafish@s...
If the content is not about the business of the Sea Fish Industry Authority
or the sea fish industry then the message is neither from nor sanctioned
by the Sea Fish Industry Authority.
_____________________________________________________________________
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
Message #6 by Jean Halstad <J_Halstad@S...> on Thu, 14 Mar 2002 11:32:14 -0000
|
|
Sorry, eating humble pie. I tried it and it did get rid of the error
message. However the string is still not being found, although it is there.
Is the type mismatch error a clue?
Can't do that. All I know is the string might be in there somewhere amongst
other strings, so sometimes it will start from 1, sometimes from 10, etc.
The string I am searching for is always 9 characters long.
-----Original Message-----
From: Craig Flannigan [mailto:ckf@k...]
Sent: 14 March 2002 09:39
To: ASP Web HowTo
Subject: [asp_web_howto] RE: inStr
Use this...
Instr(StartFrom, TB1, "0900-0930",1)
Where StartFrom is a character number. For example, if you wished to search
your string 3 characters in from the left, you'd use '3'
If you're wanting to search from the beginning of the string, just enter 1.
Zero doesn't work.
---> If Instr(1, TB!, "0900-0930", 1) Then ...
HTH,
Craig.
-----Original Message-----
From: Jean Halstad [mailto:J_Halstad@S...]
Sent: 14 March 2002 09:30
To: ASP Web HowTo
Subject: [asp_web_howto] inStr
Have written this:
if not instr(TB1, "0900-0930", 1) then .....
TB1 is a variable containing text
Am getting this error
Type mismatch: '[string: "0930-1000"]'
Have done a response.write, and sure enough the string is not being found,
although I know it is there.
What am I doing wrong?
*******SEAFOOD WEEK*******
4 to 11 October 2002
to register your interest contact us on
seafoodweek@s...
***************************************************************************
This e-mail and any files transmitted with it are confidential and intended
solely for the use of the individual or entity to whom they are addressed
If you have received this e-mail in error please notify
seafish@s...
If the content is not about the business of the Sea Fish Industry Authority
or the sea fish industry then the message is neither from nor sanctioned
by the Sea Fish Industry Authority.
_____________________________________________________________________
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
*******SEAFOOD WEEK*******
4 to 11 October 2002
to register your interest contact us on
seafoodweek@s...
***************************************************************************
This e-mail and any files transmitted with it are confidential and intended
solely for the use of the individual or entity to whom they are addressed
If you have received this e-mail in error please notify
seafish@s...
If the content is not about the business of the Sea Fish Industry Authority
or the sea fish industry then the message is neither from nor sanctioned
by the Sea Fish Industry Authority.
Message #7 by "Ken Schaefer" <ken@a...> on Fri, 15 Mar 2002 09:57:14 +1100
|
|
It seems to me that you are searching the string "0930-1000" for occurences
of "0900-0930" which would lead to *no* matches since the second string does
not appear in the first string.
Cheers
Ken
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: "Jean Halstad" <J_Halstad@S...>
Subject: [asp_web_howto] RE: inStr
: Sorry, eating humble pie. I tried it and it did get rid of the error
: message. However the string is still not being found, although it is
there.
: Is the type mismatch error a clue?
:
: -----Original Message-----
: From: Craig Flannigan [mailto:ckf@k...]
: Sent: 14 March 2002 09:39
: To: ASP Web HowTo
: Subject: [asp_web_howto] RE: inStr
:
:
:
: Use this...
: Instr(StartFrom, TB1, "0900-0930",1)
:
: Where StartFrom is a character number. For example, if you wished to
search
: your string 3 characters in from the left, you'd use '3'
:
: If you're wanting to search from the beginning of the string, just enter
1.
: Zero doesn't work.
:
:
: ---> If Instr(1, TB!, "0900-0930", 1) Then ...
:
:
: HTH,
: Craig.
:
:
: -----Original Message-----
: From: Jean Halstad [mailto:J_Halstad@S...]
: Sent: 14 March 2002 09:30
: To: ASP Web HowTo
: Subject: [asp_web_howto] inStr
:
:
: Have written this:
: if not instr(TB1, "0900-0930", 1) then .....
: TB1 is a variable containing text
: Am getting this error
: Type mismatch: '[string: "0930-1000"]'
: Have done a response.write, and sure enough the string is not being found,
: although I know it is there.
: What am I doing wrong?
.
Message #8 by "Craig Flannigan" <ckf@k...> on Fri, 15 Mar 2002 09:12:07 -0000
|
|
To be honest, if this is a date/time search, for a booking system, you are
far better off storing the start and end times in different fields, as a
Date/Time field.
As Ken states - your search will not work properly.
I had the same problem before trying to find the number 24 from this string:
109,124,45,28,235,23232,24,674,32
Using the Instr DID find 24, but it found it in 124, and then again at 24
later on in the string.
Not reliable unless you start adding other code to work around it.
Regards
Craig.
-----Original Message-----
From: Ken Schaefer [mailto:ken@a...]
Sent: 14 March 2002 22:57
To: ASP Web HowTo
Subject: [asp_web_howto] RE: inStr
It seems to me that you are searching the string "0930-1000" for occurences
of "0900-0930" which would lead to *no* matches since the second string does
not appear in the first string.
Cheers
Ken
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: "Jean Halstad" <J_Halstad@S...>
Subject: [asp_web_howto] RE: inStr
: Sorry, eating humble pie. I tried it and it did get rid of the error
: message. However the string is still not being found, although it is
there.
: Is the type mismatch error a clue?
:
: -----Original Message-----
: From: Craig Flannigan [mailto:ckf@k...]
: Sent: 14 March 2002 09:39
: To: ASP Web HowTo
: Subject: [asp_web_howto] RE: inStr
:
:
:
: Use this...
: Instr(StartFrom, TB1, "0900-0930",1)
:
: Where StartFrom is a character number. For example, if you wished to
search
: your string 3 characters in from the left, you'd use '3'
:
: If you're wanting to search from the beginning of the string, just enter
1.
: Zero doesn't work.
:
:
: ---> If Instr(1, TB!, "0900-0930", 1) Then ...
:
:
: HTH,
: Craig.
:
:
: -----Original Message-----
: From: Jean Halstad [mailto:J_Halstad@S...]
: Sent: 14 March 2002 09:30
: To: ASP Web HowTo
: Subject: [asp_web_howto] inStr
:
:
: Have written this:
: if not instr(TB1, "0900-0930", 1) then .....
: TB1 is a variable containing text
: Am getting this error
: Type mismatch: '[string: "0930-1000"]'
: Have done a response.write, and sure enough the string is not being found,
: although I know it is there.
: What am I doing wrong?
_____________________________________________________________________
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
Message #9 by Jean Halstad <J_Halstad@S...> on Fri, 15 Mar 2002 09:46:15 -0000
|
|
Thanks to everybody. The boolean if Instr(StartFrom, TB1, "0900-0930") > 0
was what was needed.
Fortunately for me, Craig, all the strings searched for are unique, so I
don't have the problem you highlighted, but I will bear it in mind for the
future.
I am using unique blocks of time because that way I can use a select
statement to check whether the time has already been booked, and simply not
offer those blocks to the user, thus preventing double booking. If I let
users enter start and end times, even if I restrict them to half hour
intervals, I just can't figure out how to prevent double booking.
-----Original Message-----
From: Craig Flannigan [mailto:ckf@k...]
Sent: 15 March 2002 09:12
To: ASP Web HowTo
Subject: [asp_web_howto] RE: inStr
To be honest, if this is a date/time search, for a booking system, you are
far better off storing the start and end times in different fields, as a
Date/Time field.
As Ken states - your search will not work properly.
I had the same problem before trying to find the number 24 from this string:
109,124,45,28,235,23232,24,674,32
Using the Instr DID find 24, but it found it in 124, and then again at 24
later on in the string.
Not reliable unless you start adding other code to work around it.
Regards
Craig.
-----Original Message-----
From: Ken Schaefer [mailto:ken@a...]
Sent: 14 March 2002 22:57
To: ASP Web HowTo
Subject: [asp_web_howto] RE: inStr
It seems to me that you are searching the string "0930-1000" for occurences
of "0900-0930" which would lead to *no* matches since the second string does
not appear in the first string.
Cheers
Ken
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: "Jean Halstad" <J_Halstad@S...>
Subject: [asp_web_howto] RE: inStr
: Sorry, eating humble pie. I tried it and it did get rid of the error
: message. However the string is still not being found, although it is
there.
: Is the type mismatch error a clue?
:
: -----Original Message-----
: From: Craig Flannigan [mailto:ckf@k...]
: Sent: 14 March 2002 09:39
: To: ASP Web HowTo
: Subject: [asp_web_howto] RE: inStr
:
:
:
: Use this...
: Instr(StartFrom, TB1, "0900-0930",1)
:
: Where StartFrom is a character number. For example, if you wished to
search
: your string 3 characters in from the left, you'd use '3'
:
: If you're wanting to search from the beginning of the string, just enter
1.
: Zero doesn't work.
:
:
: ---> If Instr(1, TB!, "0900-0930", 1) Then ...
:
:
: HTH,
: Craig.
:
:
: -----Original Message-----
: From: Jean Halstad [mailto:J_Halstad@S...]
: Sent: 14 March 2002 09:30
: To: ASP Web HowTo
: Subject: [asp_web_howto] inStr
:
:
: Have written this:
: if not instr(TB1, "0900-0930", 1) then .....
: TB1 is a variable containing text
: Am getting this error
: Type mismatch: '[string: "0930-1000"]'
: Have done a response.write, and sure enough the string is not being found,
: although I know it is there.
: What am I doing wrong?
_____________________________________________________________________
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
*******SEAFOOD WEEK*******
4 to 11 October 2002
to register your interest contact us on
seafoodweek@s...
***************************************************************************
This e-mail and any files transmitted with it are confidential and intended
solely for the use of the individual or entity to whom they are addressed
If you have received this e-mail in error please notify
seafish@s...
If the content is not about the business of the Sea Fish Industry Authority
or the sea fish industry then the message is neither from nor sanctioned
by the Sea Fish Industry Authority.
Message #10 by "Craig Flannigan" <ckf@k...> on Fri, 15 Mar 2002 10:15:34 -0000
|
|
We used this SQL to build a Conference Room booking service. You can only
book rooms that are free during the selected times - which the user choses
through dropdowns.
SELECT Booking.BookingID, Booking.BookingStartTime, Booking.BookingEndTime,
Booking.BookingDate, Booking.RoomID FROM Booking WHERE
(Booking.BookingStartTime <= #09:00# And Booking.BookingEndTime >#09:00#)
AND ((Booking.BookingDate)=#3/15/2002#) OR (Booking.BookingStartTime
<=#09:00# AND Booking.BookingEndTime >=#10:00#) AND
(Booking.BookingDate=#3/15/2002#) OR (Booking.BookingStartTime <#10:00#) AND
Booking.BookingEndTime >=#10:00# AND (Booking.BookingDate=#3/15/2002#) OR
(Booking.BookingEndTime <#10:00#) AND (Booking.BookingStartTime >#09:00#)
AND (Booking.BookingDate=#3/15/2002#); ND (Booking.BookingStartTime >#" &
Request.Form("cStart") & "#) AND (Booking.BookingDate=#" & strDate & "#);"
As you can see, it's a nightmare, but it prevents double bookings, and
allows each room to be back-to-back booked.
Regards
Craig.
-----Original Message-----
From: Jean Halstad [mailto:J_Halstad@S...]
Sent: 15 March 2002 09:46
To: ASP Web HowTo
Subject: [asp_web_howto] RE: inStr
Thanks to everybody. The boolean if Instr(StartFrom, TB1, "0900-0930") > 0
was what was needed.
Fortunately for me, Craig, all the strings searched for are unique, so I
don't have the problem you highlighted, but I will bear it in mind for the
future.
I am using unique blocks of time because that way I can use a select
statement to check whether the time has already been booked, and simply not
offer those blocks to the user, thus preventing double booking. If I let
users enter start and end times, even if I restrict them to half hour
intervals, I just can't figure out how to prevent double booking.
-----Original Message-----
From: Craig Flannigan [mailto:ckf@k...]
Sent: 15 March 2002 09:12
To: ASP Web HowTo
Subject: [asp_web_howto] RE: inStr
To be honest, if this is a date/time search, for a booking system, you are
far better off storing the start and end times in different fields, as a
Date/Time field.
As Ken states - your search will not work properly.
I had the same problem before trying to find the number 24 from this string:
109,124,45,28,235,23232,24,674,32
Using the Instr DID find 24, but it found it in 124, and then again at 24
later on in the string.
Not reliable unless you start adding other code to work around it.
Regards
Craig.
-----Original Message-----
From: Ken Schaefer [mailto:ken@a...]
Sent: 14 March 2002 22:57
To: ASP Web HowTo
Subject: [asp_web_howto] RE: inStr
It seems to me that you are searching the string "0930-1000" for occurences
of "0900-0930" which would lead to *no* matches since the second string does
not appear in the first string.
Cheers
Ken
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: "Jean Halstad" <J_Halstad@S...>
Subject: [asp_web_howto] RE: inStr
: Sorry, eating humble pie. I tried it and it did get rid of the error
: message. However the string is still not being found, although it is
there.
: Is the type mismatch error a clue?
:
: -----Original Message-----
: From: Craig Flannigan [mailto:ckf@k...]
: Sent: 14 March 2002 09:39
: To: ASP Web HowTo
: Subject: [asp_web_howto] RE: inStr
:
:
:
: Use this...
: Instr(StartFrom, TB1, "0900-0930",1)
:
: Where StartFrom is a character number. For example, if you wished to
search
: your string 3 characters in from the left, you'd use '3'
:
: If you're wanting to search from the beginning of the string, just enter
1.
: Zero doesn't work.
:
:
: ---> If Instr(1, TB!, "0900-0930", 1) Then ...
:
:
: HTH,
: Craig.
:
:
: -----Original Message-----
: From: Jean Halstad [mailto:J_Halstad@S...]
: Sent: 14 March 2002 09:30
: To: ASP Web HowTo
: Subject: [asp_web_howto] inStr
:
:
: Have written this:
: if not instr(TB1, "0900-0930", 1) then .....
: TB1 is a variable containing text
: Am getting this error
: Type mismatch: '[string: "0930-1000"]'
: Have done a response.write, and sure enough the string is not being found,
: although I know it is there.
: What am I doing wrong?
_____________________________________________________________________
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
*******SEAFOOD WEEK*******
4 to 11 October 2002
to register your interest contact us on
seafoodweek@s...
***************************************************************************
This e-mail and any files transmitted with it are confidential and intended
solely for the use of the individual or entity to whom they are addressed
If you have received this e-mail in error please notify
seafish@s...
If the content is not about the business of the Sea Fish Industry Authority
or the sea fish industry then the message is neither from nor sanctioned
by the Sea Fish Industry Authority.
_____________________________________________________________________
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
Message #11 by "Orr, Anthony" <aorr@d...> on Fri, 15 Mar 2002 10:15:37 -0600
|
|
This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.
------_=_NextPart_001_01C1CC3C.A4D96820
Content-Type: text/plain;
charset="iso-8859-1"
if not InStr ... won't work, because it's not a boolean value. Use this
instead:
if instr(TB1, "0900-0930", 1) = 0 then ...
if the string isn't found, the return value is 0. Otherwise, it returns the
value of the first character placement.
-----Original Message-----
From: Ken Schaefer [mailto:ken@a...]
Sent: Thursday, March 14, 2002 5:57 PM
Subject: RE: inStr
It seems to me that you are searching the string "0930-1000" for occurences
of "0900-0930" which would lead to *no* matches since the second string does
not appear in the first string.
Cheers
Ken
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: "Jean Halstad" <J_Halstad@S...>
Subject: [asp_web_howto] RE: inStr
: Sorry, eating humble pie. I tried it and it did get rid of the error
: message. However the string is still not being found, although it is
there.
: Is the type mismatch error a clue?
:
: -----Original Message-----
: From: Craig Flannigan [mailto:ckf@k...]
: Sent: 14 March 2002 09:39
: To: ASP Web HowTo
: Subject: [asp_web_howto] RE: inStr
:
:
:
: Use this...
: Instr(StartFrom, TB1, "0900-0930",1)
:
: Where StartFrom is a character number. For example, if you wished to
search
: your string 3 characters in from the left, you'd use '3'
:
: If you're wanting to search from the beginning of the string, just enter
1.
: Zero doesn't work.
:
:
: ---> If Instr(1, TB!, "0900-0930", 1) Then ...
:
:
: HTH,
: Craig.
:
:
: -----Original Message-----
: From: Jean Halstad [mailto:J_Halstad@S...]
: Sent: 14 March 2002 09:30
: To: ASP Web HowTo
: Subject: [asp_web_howto] inStr
:
:
: Have written this:
: if not instr(TB1, "0900-0930", 1) then .....
: TB1 is a variable containing text
: Am getting this error
: Type mismatch: '[string: "0930-1000"]'
: Have done a response.write, and sure enough the string is not being found,
: although I know it is there.
: What am I doing wrong?
.
Message #12 by "Ken Schaefer" <ken@a...> on Sun, 17 Mar 2002 17:21:56 +1100
|
|
This is a multi-part message in MIME format.
------=_NextPart_000_0219_01C1CDD8.3D2528C0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: "Jean Halstad" <J_Halstad@S...>
Subject: [asp_web_howto] RE: inStr
: I am using unique blocks of time because that way I can use a select
: statement to check whether the time has already been booked, and
simply not
: offer those blocks to the user, thus preventing double booking. If I
let
: users enter start and end times, even if I restrict them to half hour
: intervals, I just can't figure out how to prevent double booking.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
I'm sorry that you couldn't work it out. That doesn't mean that the way
you are doing it is any good.
If you want to prevent double booking, it's fairly simple. It's easier
if you have a piece of paper.
Draw a line that indicates the length of time of a proposed booking. Now
draw more lines to indicate possible overlaps (eg see rudimentary
diagram below). Red is the proposed booking. Blue are the overlapping
bookings.
|----------|
|-----------------------|
|----------|
|-------|
|--------------|
The above are all the possible ways a proposed booking can overlap with
an existing booking. If none of the conditions exist, you enter the
proposed booking in the database.
Thus if (ST=3DStartTime, ET=3DEndTime)
(
ExistingST < ProposedST AND ExistingET > ProposedET -- covers first
two possibilities
OR
ExistingST > ProposedST AND ExistingET < ProposedET -- covers 3rd
possiblity
OR
ExistingST < ProposedET AND ExistingET > ProposedET -- covers 4th
possiblity
)
then you have an overlapping condition. If the Recordset is EOF then
there is no overlap, and you can insert the new booking.
Cheers
Ken
Message #13 by Jean Halstad <J_Halstad@S...> on Wed, 20 Mar 2002 14:54:30 -0000
|
|
Thanks for the time you took to explain this, Ken. Next time I need to do
something like this, I will try it your way. My way does actually work. An
SQL query is used to show the user the time blocks booked on a particular
day. There is a check box beside each one to enable the user to delete those
items. The recordset is then searched using inStr to identify the timeblocks
not booked, and the user is then given an opportunity to book them using a
list box.
-----Original Message-----
From: Ken Schaefer [mailto:ken@a...]
Sent: 17 March 2002 06:22
To: ASP Web HowTo
Subject: [asp_web_howto] RE: inStr
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: "Jean Halstad" < <mailto:J_Halstad@S...>
J_Halstad@S...>
Subject: [asp_web_howto] RE: inStr
: I am using unique blocks of time because that way I can use a select
: statement to check whether the time has already been booked, and simply
not
: offer those blocks to the user, thus preventing double booking. If I let
: users enter start and end times, even if I restrict them to half hour
: intervals, I just can't figure out how to prevent double booking.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
I'm sorry that you couldn't work it out. That doesn't mean that the way you
are doing it is any good.
If you want to prevent double booking, it's fairly simple. It's easier if
you have a piece of paper.
Draw a line that indicates the length of time of a proposed booking. Now
draw more lines to indicate possible overlaps (eg see rudimentary diagram
below). Red is the proposed booking. Blue are the overlapping bookings.
|----------|
|-----------------------|
|----------|
|-------|
|--------------|
The above are all the possible ways a proposed booking can overlap with an
existing booking. If none of the conditions exist, you enter the proposed
booking in the database.
Thus if (ST=StartTime, ET=EndTime)
(
ExistingST < ProposedST AND ExistingET > ProposedET -- covers first two
possibilities
OR
ExistingST > ProposedST AND ExistingET < ProposedET -- covers 3rd
possiblity
OR
ExistingST < ProposedET AND ExistingET > ProposedET -- covers 4th
possiblity
)
then you have an overlapping condition. If the Recordset is EOF then there
is no overlap, and you can insert the new booking.
Cheers
Ken
---
*******SEAFOOD WEEK*******
4 to 11 October 2002
to register your interest contact us on
seafoodweek@s...
***************************************************************************
This e-mail and any files transmitted with it are confidential and intended
solely for the use of the individual or entity to whom they are addressed
If you have received this e-mail in error please notify
seafish@s...
If the content is not about the business of the Sea Fish Industry Authority
or the sea fish industry then the message is neither from nor sanctioned
by the Sea Fish Industry Authority.
Message #14 by "Ken Schaefer" <ken@a...> on Fri, 22 Mar 2002 09:51:16 +1100
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: "Jean Halstad" <J_Halstad@S...>
Subject: [asp_web_howto] RE: inStr
: Thanks for the time you took to explain this, Ken. Next time I need to do
: something like this, I will try it your way. My way does actually work.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
It works now, for what you need it to do now.
Later on when you need to do calculations (because management wants a
summary report), or when you need to change the way the system works
(because people want to be able to make a 48 hour booking without having to
check 96 boxes), then you will have to start coding all sorts of messy
workarounds.
It's kind of a fundamental design principle - if you are storing dates, use
a date field. If you are storing text, use a text field. If you are storing
integers, use an integer type field. We don't store text as a series of
ASCII values in a number field, so why store date/times in a text field?
Cheers
Ken
|
|
 |