How to handle a variable

B

Bob

I have a login name stored in MS Access and use it to set
a session variable when I log in. The field in the Db is
10 characters long. I cannot make a string variable and
use it in a frontpage query to retrieve other
information, as my actual info as stored in the session
variable is only 7 positions long.

Frontpage database results will not return data when it
is set equal to the variable and using a LIKE returns
everyone. I've tried using %'s in front and back, but
cannot get frontpage to render up a recordset.

How can I make this session variable that is 7 positions
long appear to be 10, so frontpage will return data?

And advice would be appreciated.
 
K

Kevin Spencer

Hi Bob,

There is a difference between the length of a field/column in a database,
and the length of the data stored in it. You can have a field/column in the
database that is 10 characters long, and insert or retrieve a value from or
to it that is less than that in length.

If your 10-character field is padded out with spaces, I would suggest
padding out the value you pass in so that it is 10 characters long including
padding (spaces).

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
What You Seek Is What You Get.
 
G

Guest

Kevin I tried what I thought was the correct thing by
adding " " to the variable to make it 10 spaces long.
Then I resampled it to see how long it was and did a
response.write to look at the value and it was still 7
spaces long, leaving me with the same problem.

I use strval=Len(string) to determine the length.

What do I actually have to do to add additonal length at
the end to the variable to make it appear to be the value
plus 3 spaces to make it work in a query?

I'd really appreciate a clue on this one. I just can seem
to find the answer to it, yet it must be a simple one.
Maybe to simple?
 
S

Stefan B Rusynko

Go back to basics
Why are you creating a session variable for comparing to the DB that is either
- not the same length as your DB field value
- or better still using your actual DB field value





| Kevin I tried what I thought was the correct thing by
| adding " " to the variable to make it 10 spaces long.
| Then I resampled it to see how long it was and did a
| response.write to look at the value and it was still 7
| spaces long, leaving me with the same problem.
|
| I use strval=Len(string) to determine the length.
|
| What do I actually have to do to add additonal length at
| the end to the variable to make it appear to be the value
| plus 3 spaces to make it work in a query?
|
| I'd really appreciate a clue on this one. I just can seem
| to find the answer to it, yet it must be a simple one.
| Maybe to simple?
| >-----Original Message-----
| >Hi Bob,
| >
| >There is a difference between the length of a
| field/column in a database,
| >and the length of the data stored in it. You can have a
| field/column in the
| >database that is 10 characters long, and insert or
| retrieve a value from or
| >to it that is less than that in length.
| >
| >If your 10-character field is padded out with spaces, I
| would suggest
| >padding out the value you pass in so that it is 10
| characters long including
| >padding (spaces).
| >
| >--
| >HTH,
| >
| >Kevin Spencer
| >Microsoft MVP
| >..Net Developer
| >What You Seek Is What You Get.
| >
| message
| >| >>I have a login name stored in MS Access and use it to
| set
| >> a session variable when I log in. The field in the Db
| is
| >> 10 characters long. I cannot make a string variable and
| >> use it in a frontpage query to retrieve other
| >> information, as my actual info as stored in the session
| >> variable is only 7 positions long.
| >>
| >> Frontpage database results will not return data when it
| >> is set equal to the variable and using a LIKE returns
| >> everyone. I've tried using %'s in front and back, but
| >> cannot get frontpage to render up a recordset.
| >>
| >> How can I make this session variable that is 7
| positions
| >> long appear to be 10, so frontpage will return data?
| >>
| >> And advice would be appreciated.
| >
| >
| >.
| >
 
B

Bob L.

I don't think there is a going back to the basics. A login piece of
information from a form is being used as a session variable. In the Frontpage
form, the information entered the exact same length as used in the database.
When the code does the comparisson it finds they are qualified and goes to a
default page exactly as it shold perform. That is NOT my problem.

Want I wanted to be able to do is use that Session Variable information on
another Frontpage database insert to query for a piece of infromation. This
can't be done, as the field that started out as 10 positons long is now 7
positions long. Therefore, frontpage will not return a query as it doesn't
see them as the same.

I was asking for help how to solve this problem?

Can you dimension the size of a variable in script in frontpage, so that it
will keep the size when you tell it that it is equal to the session variable
value?

Or, do you need to add padding to the variable to make it extend from a
length of 7 to 10 so that frontpage won't be viewing is as not equal? If so,
how is this done?

I've used LIKE and it simply returns everything from the table, which isn't
right. And that was with the % signs, in front or back to see if I could find
any difference. It seems frontpage only likes a value passed to it from a
form or forget about it.

There should be a simple fix for me here and that is all I'm asking for.

Thanks a ton for your input!
 
S

Stefan B Rusynko

Padding won't necessarily make them "equal" unless the padding 3 chars are always a 100% match
If your Session variable is 10 and your other DB field is 7:
- What you can to is take the part of the Session variable that is 7 and try to match it using say
IF Left(SessionVariable,7) = DBfieldname

Or vise versa

Then again, if possible, changing the 2nd DB field to be 10 and making the data the same is probably a better solution

_____________________________________________
SBR @ ENJOY (-: [ Microsoft MVP - FrontPage ]
"Warning - Using the F1 Key will not break anything!" (-;
To find the best Newsgroup for FrontPage support see:
http://www.net-sites.com/sitebuilder/newsgroups.asp
_____________________________________________


|I don't think there is a going back to the basics. A login piece of
| information from a form is being used as a session variable. In the Frontpage
| form, the information entered the exact same length as used in the database.
| When the code does the comparisson it finds they are qualified and goes to a
| default page exactly as it shold perform. That is NOT my problem.
|
| Want I wanted to be able to do is use that Session Variable information on
| another Frontpage database insert to query for a piece of infromation. This
| can't be done, as the field that started out as 10 positons long is now 7
| positions long. Therefore, frontpage will not return a query as it doesn't
| see them as the same.
|
| I was asking for help how to solve this problem?
|
| Can you dimension the size of a variable in script in frontpage, so that it
| will keep the size when you tell it that it is equal to the session variable
| value?
|
| Or, do you need to add padding to the variable to make it extend from a
| length of 7 to 10 so that frontpage won't be viewing is as not equal? If so,
| how is this done?
|
| I've used LIKE and it simply returns everything from the table, which isn't
| right. And that was with the % signs, in front or back to see if I could find
| any difference. It seems frontpage only likes a value passed to it from a
| form or forget about it.
|
| There should be a simple fix for me here and that is all I'm asking for.
|
| Thanks a ton for your input!
|
| "Stefan B Rusynko" wrote:
|
| > Go back to basics
| > Why are you creating a session variable for comparing to the DB that is either
| > - not the same length as your DB field value
| > - or better still using your actual DB field value
| >
| >
| > --
| >
| > _____________________________________________
| > SBR @ ENJOY (-: [ Microsoft MVP - FrontPage ]
| > "Warning - Using the F1 Key will not break anything!" (-;
| > To find the best Newsgroup for FrontPage support see:
| > http://www.net-sites.com/sitebuilder/newsgroups.asp
| > _____________________________________________
| >
| >
| > | Kevin I tried what I thought was the correct thing by
| > | adding " " to the variable to make it 10 spaces long.
| > | Then I resampled it to see how long it was and did a
| > | response.write to look at the value and it was still 7
| > | spaces long, leaving me with the same problem.
| > |
| > | I use strval=Len(string) to determine the length.
| > |
| > | What do I actually have to do to add additonal length at
| > | the end to the variable to make it appear to be the value
| > | plus 3 spaces to make it work in a query?
| > |
| > | I'd really appreciate a clue on this one. I just can seem
| > | to find the answer to it, yet it must be a simple one.
| > | Maybe to simple?
| > | >-----Original Message-----
| > | >Hi Bob,
| > | >
| > | >There is a difference between the length of a
| > | field/column in a database,
| > | >and the length of the data stored in it. You can have a
| > | field/column in the
| > | >database that is 10 characters long, and insert or
| > | retrieve a value from or
| > | >to it that is less than that in length.
| > | >
| > | >If your 10-character field is padded out with spaces, I
| > | would suggest
| > | >padding out the value you pass in so that it is 10
| > | characters long including
| > | >padding (spaces).
| > | >
| > | >--
| > | >HTH,
| > | >
| > | >Kevin Spencer
| > | >Microsoft MVP
| > | >..Net Developer
| > | >What You Seek Is What You Get.
| > | >
| > | message
| > | >| > | >>I have a login name stored in MS Access and use it to
| > | set
| > | >> a session variable when I log in. The field in the Db
| > | is
| > | >> 10 characters long. I cannot make a string variable and
| > | >> use it in a frontpage query to retrieve other
| > | >> information, as my actual info as stored in the session
| > | >> variable is only 7 positions long.
| > | >>
| > | >> Frontpage database results will not return data when it
| > | >> is set equal to the variable and using a LIKE returns
| > | >> everyone. I've tried using %'s in front and back, but
| > | >> cannot get frontpage to render up a recordset.
| > | >>
| > | >> How can I make this session variable that is 7
| > | positions
| > | >> long appear to be 10, so frontpage will return data?
| > | >>
| > | >> And advice would be appreciated.
| > | >
| > | >
| > | >.
| > | >
| >
| >
| >
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top