473,399 Members | 4,177 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

drop down population help needed - thanks


In my data base I have a list of componet types e.g. type A - I have 8 off
- type B I have 12 off etc.

I'm using

Set objRS = objDC.Execute("Select DISTINCT Component_Type FROM
Parts_Table")

to populate a drop down but would like to use several drop downs
restricting the contents of each drop down to the records pertaining to one
particular componet type eg a drop down only for type A, only for type B
etc.

can this be done if so how?

The other thing I like to do is add the price field to the drop down list
(two fields in one drop down) is this done just by seperating the fields by
a ","?
Jul 19 '05 #1
46 5087
You have two choices.
1) Do it server-side. Display just the first drop down box, then when a
selection is made, post the form back to itself, and prepare/present the
second form.
2) Do it client-side. This is the most common approach, and you'll see tons
of examples on the web.

Tom B

"Kingdom" <ki*******@removehotmail.com> wrote in message
news:Xn*****************************@194.117.133.1 34...

In my data base I have a list of componet types e.g. type A - I have 8 off
- type B I have 12 off etc.

I'm using

Set objRS = objDC.Execute("Select DISTINCT Component_Type FROM
Parts_Table")

to populate a drop down but would like to use several drop downs
restricting the contents of each drop down to the records pertaining to one particular componet type eg a drop down only for type A, only for type B
etc.

can this be done if so how?

The other thing I like to do is add the price field to the drop down list
(two fields in one drop down) is this done just by seperating the fields by a ","?

Jul 19 '05 #2
"Tom B" <sh*****@hotmail.com> wrote in
news:Oc**************@TK2MSFTNGP09.phx.gbl:
You have two choices.
1) Do it server-side. Display just the first drop down box, then when
a selection is made, post the form back to itself, and prepare/present
the second form.
2) Do it client-side. This is the most common approach, and you'll
see tons of examples on the web.

Tom B

"Kingdom" <ki*******@removehotmail.com> wrote in message
news:Xn*****************************@194.117.133.1 34...

In my data base I have a list of componet types e.g. type A - I have
8 off - type B I have 12 off etc.

I'm using

Set objRS = objDC.Execute("Select DISTINCT Component_Type FROM
Parts_Table")

to populate a drop down but would like to use several drop downs
restricting the contents of each drop down to the records pertaining
to

one
particular componet type eg a drop down only for type A, only for
type B etc.

can this be done if so how?

The other thing I like to do is add the price field to the drop down
list (two fields in one drop down) is this done just by seperating
the fields

by
a ","?


Don't want to do it serverside, don't want to refresh the page untill I
get all the selections.

Telling me that I can find it on the web is a bit like telling me search
engines find things, I know there will be millions of people doing this
but I asked here because here I can communicate with a person rather than
look at some unrelated webpage.

--
We are all in the gutter, but some of us are looking at the stars.

================================================== =======================
Walrus Home alt.binaries.pictures.wallpaper <=vote here every weekend.
weekly entries posted on
http://web.newsguy.com/evilsideshowbob/entries.html
FAQ found at http://members.rogers.com/heretic54/
(The most up to date version is posted in alt.binaries.pictures.wallpaper
on Mondays and Thursdays. PLEASE READ BEFORE POSTING)
Walrus websites: http://web.newsguy.com/evilsideshowbob/
For Contest Archives & Artists http://www.weeklywalrus.com
For contestants map http://members.shaw.ca/weeklywalrus/home.html
Jul 19 '05 #3
Then you need to refer to a client side newsgroup.

Or, find a website that does what you like, and look at the source.


"Kingdom" <ki*******@removehotmail.com> wrote in message
news:Xn*****************************@194.117.133.1 34...
"Tom B" <sh*****@hotmail.com> wrote in
news:Oc**************@TK2MSFTNGP09.phx.gbl:
You have two choices.
1) Do it server-side. Display just the first drop down box, then when
a selection is made, post the form back to itself, and prepare/present
the second form.
2) Do it client-side. This is the most common approach, and you'll
see tons of examples on the web.

Tom B

"Kingdom" <ki*******@removehotmail.com> wrote in message
news:Xn*****************************@194.117.133.1 34...

In my data base I have a list of componet types e.g. type A - I have
8 off - type B I have 12 off etc.

I'm using

Set objRS = objDC.Execute("Select DISTINCT Component_Type FROM
Parts_Table")

to populate a drop down but would like to use several drop downs
restricting the contents of each drop down to the records pertaining
to

one
particular componet type eg a drop down only for type A, only for
type B etc.

can this be done if so how?

The other thing I like to do is add the price field to the drop down
list (two fields in one drop down) is this done just by seperating
the fields

by
a ","?


Don't want to do it serverside, don't want to refresh the page untill I
get all the selections.

Telling me that I can find it on the web is a bit like telling me search
engines find things, I know there will be millions of people doing this
but I asked here because here I can communicate with a person rather than
look at some unrelated webpage.

--
We are all in the gutter, but some of us are looking at the stars.

================================================== =======================
Walrus Home alt.binaries.pictures.wallpaper <=vote here every weekend.
weekly entries posted on
http://web.newsguy.com/evilsideshowbob/entries.html
FAQ found at http://members.rogers.com/heretic54/
(The most up to date version is posted in alt.binaries.pictures.wallpaper
on Mondays and Thursdays. PLEASE READ BEFORE POSTING)
Walrus websites: http://web.newsguy.com/evilsideshowbob/
For Contest Archives & Artists http://www.weeklywalrus.com
For contestants map http://members.shaw.ca/weeklywalrus/home.html

Jul 19 '05 #4
"Tom B" <sh*****@hotmail.com> wrote in
news:#v**************@TK2MSFTNGP10.phx.gbl:
Then you need to refer to a client side newsgroup.

Or, find a website that does what you like, and look at the source.


"Kingdom" <ki*******@removehotmail.com> wrote in message
news:Xn*****************************@194.117.133.1 34...
"Tom B" <sh*****@hotmail.com> wrote in
news:Oc**************@TK2MSFTNGP09.phx.gbl:
> You have two choices.
> 1) Do it server-side. Display just the first drop down box, then
> when a selection is made, post the form back to itself, and
> prepare/present the second form.
> 2) Do it client-side. This is the most common approach, and you'll
> see tons of examples on the web.
>
> Tom B
>
> "Kingdom" <ki*******@removehotmail.com> wrote in message
> news:Xn*****************************@194.117.133.1 34...
>>
>> In my data base I have a list of componet types e.g. type A - I
>> have 8 off - type B I have 12 off etc.
>>
>> I'm using
>>
>> Set objRS = objDC.Execute("Select DISTINCT Component_Type FROM
>> Parts_Table")
>>
>> to populate a drop down but would like to use several drop downs
>> restricting the contents of each drop down to the records
>> pertaining to
> one
>> particular componet type eg a drop down only for type A, only for
>> type B etc.
>>
>> can this be done if so how?
>>
>> The other thing I like to do is add the price field to the drop
>> down list (two fields in one drop down) is this done just by
>> seperating the fields
> by
>> a ","?
>
>
>

Don't want to do it serverside, don't want to refresh the page untill
I get all the selections.

Telling me that I can find it on the web is a bit like telling me
search engines find things, I know there will be millions of people
doing this but I asked here because here I can communicate with a
person rather than look at some unrelated webpage.

--
We are all in the gutter, but some of us are looking at the stars.

================================================== ====================
=== Walrus Home alt.binaries.pictures.wallpaper <=vote here every
weekend. weekly entries posted on
http://web.newsguy.com/evilsideshowbob/entries.html
FAQ found at http://members.rogers.com/heretic54/
(The most up to date version is posted in
alt.binaries.pictures.wallpaper on Mondays and Thursdays. PLEASE READ
BEFORE POSTING) Walrus websites:
http://web.newsguy.com/evilsideshowbob/ For Contest Archives &
Artists http://www.weeklywalrus.com For contestants map
http://members.shaw.ca/weeklywalrus/home.html



So what your saying is that if I'm working with ASP and require help with
some aspect that's client based I should'nt seek help here?

And to be halpfull you have gone to the great trouble of pointing out
that other websites have solved this problem and if I look elsewhere I
should find the answer to that which I seek?

Why did you bother to respond at all? you have told me nothing and
explained nothing

--
We are all in the gutter, but some of us are looking at the stars.

================================================== =======================
Walrus Home alt.binaries.pictures.wallpaper <=vote here every weekend.
weekly entries posted on
http://web.newsguy.com/evilsideshowbob/entries.html
FAQ found at http://members.rogers.com/heretic54/
(The most up to date version is posted in alt.binaries.pictures.wallpaper
on Mondays and Thursdays. PLEASE READ BEFORE POSTING)
Walrus websites: http://web.newsguy.com/evilsideshowbob/
For Contest Archives & Artists http://www.weeklywalrus.com
For contestants map http://members.shaw.ca/weeklywalrus/home.html
Jul 19 '05 #5
Kingdom wrote:

So what your saying is that if I'm working with ASP and require help
with some aspect that's client based I should'nt seek help here?
Give the man a cigar!

Client-side questions are off-topic in an asp newsgroup. If you take a look
at the other threads in this newsgroup, you will see that we are happy to
help with asp questions.

There are many reasons to keep the newsgroups focussed on specific topics.
If you're not interested in conforming to basic netiquette then you're not
likely to receive much sympathy.

And to be halpfull you have gone to the great trouble of pointing out
that other websites have solved this problem and if I look elsewhere I
should find the answer to that which I seek?

Why did you bother to respond at all? you have told me nothing and
explained nothing


Would you rather we all just ignore this message leaving you wondering why
nobody has responded? Is that what you consider being helpful?

Tom took time out of his day to try and help you by offering suggestions
about where to find your answer, and you respond by telling him to shut up?
I suppose you're going to tell me to shut up now. Don't bother.

--
HTH,
Bob Barrows - ASP MVP
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Jul 19 '05 #6
So what your saying is that if I'm working with ASP and require help with
some aspect that's client based I should'nt seek help here?

And to be halpfull you have gone to the great trouble of pointing out
that other websites have solved this problem and if I look elsewhere I
should find the answer to that which I seek?

Why did you bother to respond at all? you have told me nothing and
explained nothing


Actually...

He has explained
1. You are looking for a client side script.
2. You are asking people who are interested in server side script.
3. What you ask can be done.
4. There are people who are better / more ready to help in another
location.

You have explained
1. You are not willing to do any research to find a good answer.
2. You do not understand newsgroups.
3. You are probably not the best person to write the application you
are working on :)

Jul 19 '05 #7

Yes it may be I need a client based script but my original question was
asp server based.

I'm using

Set objRS = objDC.Execute("Select DISTINCT Component_Type FROM
Parts_Table")

and simply wished to know if this line can include a statement to limit
the records displayed in the drop down to a specific group. Now that
might not be possible, iI don't know but it's not java script and I might
have to look at a million webpages to find one that had the statement I'm
looking for, if it is at all possible.

Hence my post.

I'm sorry if my question was not up to the quality you guys require but
this did seem to be the logical place to ask but rather than someone say
yes do this or no there is no way to do that with this statement I end up
geting a lecture on maners and anything but the statement I seek, put
through the third degree, tried, judged and hanged, and book written
about my impertanence for asking.

Thanks a bunch guys no doubt you were all born with your coding skills!
Jul 19 '05 #8
This thread is ammusing. Thanks y'all.

Kingdom, thicken your skin. If this is how you react to a post in a
newsgroup, I'd hate to see how you handle real life. Step back and realize
that you received help.

Ray at work
"Kingdom" <ki*******@removehotmail.com> wrote in message
news:Xn*****************************@194.117.133.1 34...

Yes it may be I need a client based script but my original question was
asp server based.

I'm using

Set objRS = objDC.Execute("Select DISTINCT Component_Type FROM
Parts_Table")

and simply wished to know if this line can include a statement to limit
the records displayed in the drop down to a specific group. Now that
might not be possible, iI don't know but it's not java script and I might
have to look at a million webpages to find one that had the statement I'm
looking for, if it is at all possible.

Hence my post.

I'm sorry if my question was not up to the quality you guys require but
this did seem to be the logical place to ask but rather than someone say
yes do this or no there is no way to do that with this statement I end up
geting a lecture on maners and anything but the statement I seek, put
through the third degree, tried, judged and hanged, and book written
about my impertanence for asking.

Thanks a bunch guys no doubt you were all born with your coding skills!

Jul 19 '05 #9
On Tue, 14 Oct 2003 15:58:46 GMT, Kingdom
<ki*******@removehotmail.com> wrote:

Yes it may be I need a client based script but my original question was
asp server based.

I'm using

Set objRS = objDC.Execute("Select DISTINCT Component_Type FROM
Parts_Table")

and simply wished to know if this line can include a statement to limit
the records displayed in the drop down to a specific group. Now that
might not be possible, iI don't know but it's not java script and I might
have to look at a million webpages to find one that had the statement I'm
looking for, if it is at all possible.

Hence my post.

I'm sorry if my question was not up to the quality you guys require but
this did seem to be the logical place to ask but rather than someone say
yes do this or no there is no way to do that with this statement I end up
geting a lecture on maners and anything but the statement I seek, put
through the third degree, tried, judged and hanged, and book written
about my impertanence for asking.

Thanks a bunch guys no doubt you were all born with your coding skills!


I think your original request has been munged entirely. The way I
understood it, you wanted to be able to dynamically populate a
dropdown based on a selected value from a list. It was stated that
this could be done server side or client side and you said that you
wanted it done client side so that it would not have to go back to the
server each time the user chose a different group. Good idea, and I
agree with it - but that means that the rest of your application will
need to be done client side... no? Once you know how that will be
done, you MAY need to redo your SQL, but you need to know what you
want client side before anyone can help you get it... no?

Jul 19 '05 #10
Dan Brussee <db******@NOSPAMnc.rr.com> wrote in
news:3f********************************@4ax.com:
On Tue, 14 Oct 2003 15:58:46 GMT, Kingdom
<ki*******@removehotmail.com> wrote:

Yes it may be I need a client based script but my original question
was asp server based.

I'm using

Set objRS = objDC.Execute("Select DISTINCT Component_Type FROM
Parts_Table")

and simply wished to know if this line can include a statement to
limit the records displayed in the drop down to a specific group.
Now that might not be possible, iI don't know but it's not java script
and I might have to look at a million webpages to find one that had
the statement I'm looking for, if it is at all possible.

Hence my post.

I'm sorry if my question was not up to the quality you guys require
but this did seem to be the logical place to ask but rather than
someone say yes do this or no there is no way to do that with this
statement I end up geting a lecture on maners and anything but the
statement I seek, put through the third degree, tried, judged and
hanged, and book written about my impertanence for asking.

Thanks a bunch guys no doubt you were all born with your coding
skills!
I think your original request has been munged entirely. The way I
understood it, you wanted to be able to dynamically populate a
dropdown based on a selected value from a list. It was stated that
this could be done server side or client side and you said that you
wanted it done client side so that it would not have to go back to the
server each time the user chose a different group. Good idea, and I
agree with it - but that means that the rest of your application will
need to be done client side... no? Once you know how that will be
done, you MAY need to redo your SQL, but you need to know what you
want client side before anyone can help you get it... no?


Yep, but first I simply need to know if the statement
Set objRS = objDC.Execute("Select DISTINCT Component_Type FROM
Parts_Table")


can incorporate somethig else that will do the job?

If it can what is it?
If it can't be included then I need to do something else!

and someday I'll know enough to know the answer but to day I don't and I'm
asking you people for help.

It seemed a simple question to me, it may be no one hear knows the answer,
well thats fine too but it also seems some would rather riducle and insult
the new guy rather make any effort actualy provide a definative answer that
might actually throw some light on the question.

I honestly didn't come here for a war, I'm not a troll and I'm well used to
getting around news groups.

One guy even starts mouthing off about my life outside off usenet, now what
kinda guy does that when sombody new arrives?

--
We are all in the gutter, but some of us are looking at the stars.

================================================== =======================
Walrus Home alt.binaries.pictures.wallpaper <=vote here every weekend.
weekly entries posted on
http://web.newsguy.com/evilsideshowbob/entries.html
FAQ found at http://members.rogers.com/heretic54/
(The most up to date version is posted in alt.binaries.pictures.wallpaper
on Mondays and Thursdays. PLEASE READ BEFORE POSTING)
Walrus websites: http://web.newsguy.com/evilsideshowbob/
For Contest Archives & Artists http://www.weeklywalrus.com
For contestants map http://members.shaw.ca/weeklywalrus/home.html
Jul 19 '05 #11
Kingdom wrote:
Dan Brussee <db******@NOSPAMnc.rr.com> wrote in
news:3f********************************@4ax.com:
On Tue, 14 Oct 2003 15:58:46 GMT, Kingdom
<ki*******@removehotmail.com> wrote:

Yes it may be I need a client based script but my original question
was asp server based.

I'm using

Set objRS = objDC.Execute("Select DISTINCT Component_Type FROM
Parts_Table")

and simply wished to know if this line can include a statement to
limit the records displayed in the drop down to a specific group.

Now wait a minute. You're leaving something out. From your original post: to populate a drop down but would like to use several drop downs
restricting the contents of each drop down to the records pertaining
to one particular componet type eg a drop down only for type A, only
for type B etc.


Everyone (well, at least I did) interpreted this to mean that you wished the
options in dropdown B to be dynamically based on the selection in dropdown
A. In other words, the first dropdown would contain the types (A,B, ... ).
When the user selects one, the second dropdown would only display the
components of the type selected in the first dropdown

What you really wish is to have a separate dropdown for each type? That is
much different, and can be accomplished totally within asp.

OK, let's regroup here. You can use the recordset's Filter property to,
well, filter its records. The problem is, I don't know the name of the field
that contains the data to be limited. Your query contains a single field,
Component_type. Is that the field containing the "type A ... type B"? What
is the name of the field whose data you wish to display in these dropdowns?

Could you provide a little more information? Your table structure and some
sample data? It does not have to be real data if it's confidential. Just
enough to illustrate the situation.--

HTH,
Bob Barrows - ASP MVP
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Jul 19 '05 #12

Thanks Bob, hope my explanation helps to clarify the situation, I
probably I did not make it clear enough in the original post.

I have the thing running at the moment on the B dropdown depending on the
A dropdown but its not what I want as you cannot easily make changes
without going all the way back through the thing if I can use lots of
drop downs the user could play with it till thay are satisfied with all
the selections before submitting the form, rfreshing the result to get a
proper listing with price totals etc.

Table is called Parts_Table

The product field is called 'Component_Type' with the only other field of
interest being the Price field again called 'Price'
The dbase holds several hundred records but only 34 different types of
product lets call them A,B,C,D, etc so we may have 26xA and 18xb and 6xc
etc.

Now it would suit my purpose to have 34 drop downs each populated from
the Parts_Table, Component_Type field and including the price field for
the selected products. One drop down for each of the 34 different product
type each containing information from two fields

There is no dependancy between the drop downs other than the fat they are
all populated from the same two fields but all contain different records
with no duplicates at all.

The idea being that the the user can select one product from each off the
product type groups in each of the drop downs, see the price and only
when he has done all of this to his satisfaction do I then collect
everything and refresh the page, laying it all out for him with a total
cost and options to mail etc.

eg

drop down 1 Product A - POPULATED BY

A1 PRICE
A2 PRICE
A3 PRICE
A4 PRICE
drop down 2 Product B - POPULATED BY

B1 PRICE
B2 PRICE
B3 PRICE
B4 PRICE
Jul 19 '05 #13
To be clear. You have a table called Parts_Table with the fields -
Component_Type, Price and a field for the name of the part, correct?

What I'd suggest you do, is to query the ENTIRE table, sorted by the
Component_Type then the Component_Name.

Set objRS = objDC.Execute("SELECT UniqueID, Component_Type, Price,
Component_Name FROM Parts_Table ORDER BY Component_Type, Component_Name")

This will give you a recordset with all of the items in your table sorted by
component type. I'd iterate through the list and when you hit a new
Component_Type, start a new select box.

Dim sCurrentComponentType
Set objRS = 'As above
if not objRS.EOF then
sCurrentComponentType=objRS.Fields("Component_Type ").Value
Response.Write "<select name=""" & sCurrentComponentType &
""">"
Do While not objRS.EOF
if objRS.Fields("Component_Type").Value <> sCurrentComponentType
then
sCurrentComponentType=objRS.Fields("Component_Type ").Value
Response.Write "</select>"
Response.Write "<select name=""" & sCurrentComponentType &
""">"
end if
'Now the individual options

Response.Write "<option value=""" &
objRS.Fields("UniqueID").Value & """>"
objRS.MoveNext
Loop
Response.Write "</select>"
end if
Set objRS=nothing

You should note that Bob will tell you to use GetRows to turn your Recordset
into an array. He's right, I'm sure, but I never do that.

I was away from my computer from my computer for a few hours. I did not
mean to belittle you, I think it was clearly a misunderstanding. The "I
want my second select box to change based on the choice of the first box"
question comes up frequently in this newsgroup, and it's usually the
client-side solution the person is looking for.

Tom
"Kingdom" <ki*******@removehotmail.com> wrote in message
news:Xn*****************************@194.117.158.3 2...

Thanks Bob, hope my explanation helps to clarify the situation, I
probably I did not make it clear enough in the original post.

I have the thing running at the moment on the B dropdown depending on the
A dropdown but its not what I want as you cannot easily make changes
without going all the way back through the thing if I can use lots of
drop downs the user could play with it till thay are satisfied with all
the selections before submitting the form, rfreshing the result to get a
proper listing with price totals etc.

Table is called Parts_Table

The product field is called 'Component_Type' with the only other field of
interest being the Price field again called 'Price'
The dbase holds several hundred records but only 34 different types of
product lets call them A,B,C,D, etc so we may have 26xA and 18xb and 6xc
etc.

Now it would suit my purpose to have 34 drop downs each populated from
the Parts_Table, Component_Type field and including the price field for
the selected products. One drop down for each of the 34 different product
type each containing information from two fields

There is no dependancy between the drop downs other than the fat they are
all populated from the same two fields but all contain different records
with no duplicates at all.

The idea being that the the user can select one product from each off the
product type groups in each of the drop downs, see the price and only
when he has done all of this to his satisfaction do I then collect
everything and refresh the page, laying it all out for him with a total
cost and options to mail etc.

eg

drop down 1 Product A - POPULATED BY

A1 PRICE
A2 PRICE
A3 PRICE
A4 PRICE
drop down 2 Product B - POPULATED BY

B1 PRICE
B2 PRICE
B3 PRICE
B4 PRICE

Jul 19 '05 #14
"Tom B" <sh*****@hotmail.com> wrote in
news:eE**************@TK2MSFTNGP10.phx.gbl:
To be clear. You have a table called Parts_Table with the fields -
Component_Type, Price and a field for the name of the part, correct?

What I'd suggest you do, is to query the ENTIRE table, sorted by the
Component_Type then the Component_Name.

Set objRS = objDC.Execute("SELECT UniqueID, Component_Type, Price,
Component_Name FROM Parts_Table ORDER BY Component_Type,
Component_Name")

This will give you a recordset with all of the items in your table
sorted by component type. I'd iterate through the list and when you
hit a new Component_Type, start a new select box.

Dim sCurrentComponentType
Set objRS = 'As above
if not objRS.EOF then
sCurrentComponentType=objRS.Fields("Component_Type ").Valu
e
Response.Write "<select name=""" &
sCurrentComponentType &
""">"
Do While not objRS.EOF
if objRS.Fields("Component_Type").Value <>
sCurrentComponentType
then
sCurrentComponentType=objRS.Fields("Component_Type ").Va
lue Response.Write "</select>"
Response.Write "<select name=""" &
sCurrentComponentType &
""">"
end if
'Now the individual options

Response.Write "<option value=""" &
objRS.Fields("UniqueID").Value & """>"
objRS.MoveNext
Loop
Response.Write "</select>"
end if
Set objRS=nothing

You should note that Bob will tell you to use GetRows to turn your
Recordset into an array. He's right, I'm sure, but I never do that.

I was away from my computer from my computer for a few hours. I did
not mean to belittle you, I think it was clearly a misunderstanding.
The "I want my second select box to change based on the choice of the
first box" question comes up frequently in this newsgroup, and it's
usually the client-side solution the person is looking for.

Tom


Thanks Tom, I'v saved the post and I appreciate everyones effors here.
I'll start looking at your suggestions tomorrow I'm still in the early
stages of learning ASP and my head is burned out for now.

I'll try a be a bit clearer if I have any other questions as I'm sure I
will have before I get to the point where I feel I have a handle on it
all.

Jul 19 '05 #15
Tom B wrote:
You should note that Bob will tell you to use GetRows to turn your
Recordset into an array. He's right, I'm sure, but I never do that.


:-)
Actually, in this case, I was thinking more in terms of multiple
disconnected recordsets <gasp!>, allowing the Filter property to be used to
make this processing a little easier (I'm going to assume that this is SQL
Server - I will illustrate using dynamic sql, but I suggest you encapsulate
the SQL statements into a stored procedure):

dim rs, rsTypes,rsComps, strSQL
Dim sCurCompType
'open the connection, then

Set rs= server.createobject("adodb.recordset")
rs.cursorlocation=adUseClient
strSQL= "SELECT DISTINCT Component_Type " & _
"FROM Parts_Table ORDER BY Component_Type; " & _
"SELECT UniqueID, Component_Type, Price, Component_Name " & _
"FROM Parts_Table ORDER BY Component_Type, Component_Name"
rs.Open strSQL,cn,,,adCmdText

'put the unique types into a recordset:
set rsTypes = rs.Clone
'disconnect the recordset
set rsTypes.ActiveConnection = nothing
'Put the components into another recordset and disconnect it
set rsComps = rs.NextRecordset
set rsComps.ActiveConnection = nothing

'clean up the initial recordset
rs.Close: set rs=nothing
cn.Close: set cn=nothing

'Create the dropdowns:
do until rsTypes.EOF
sCurCompType = rsTypes(0).Value
Response.Write "Component Type " & sCurCompType & ": "
Response.Write "<select name=""" & sCurCompType & """>"
rsComps.Filter="Component_Type='" & sCurCompType & "'"
do until rsComps.EOF
Response.Write "<option value-""" & rsComps(0).Value
Response.Write """>" & rsComps(2).Value
Response.Write "</option>"
rsComps.MoveNext
loop
Response.Write "</select><BR>"
rsTypes.MoveNext
loop
rsTypes.close:set rsTypes=nothing
rsComps.close:set rsComps=nothing

--
HTH,
Bob Barrows - ASP MVP
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Jul 19 '05 #16
"Bob Barrows" <re******@NOyahoo.SPAMcom> wrote in
news:#n**************@tk2msftngp13.phx.gbl:
Tom B wrote:
You should note that Bob will tell you to use GetRows to turn your
Recordset into an array. He's right, I'm sure, but I never do that.


:-)
Actually, in this case, I was thinking more in terms of multiple
disconnected recordsets <gasp!>, allowing the Filter property to be
used to make this processing a little easier (I'm going to assume that
this is SQL Server - I will illustrate using dynamic sql, but I
suggest you encapsulate the SQL statements into a stored procedure):

dim rs, rsTypes,rsComps, strSQL
Dim sCurCompType
'open the connection, then

Set rs= server.createobject("adodb.recordset")
rs.cursorlocation=adUseClient
strSQL= "SELECT DISTINCT Component_Type " & _
"FROM Parts_Table ORDER BY Component_Type; " & _
"SELECT UniqueID, Component_Type, Price, Component_Name " & _
"FROM Parts_Table ORDER BY Component_Type, Component_Name"
rs.Open strSQL,cn,,,adCmdText

'put the unique types into a recordset:
set rsTypes = rs.Clone
'disconnect the recordset
set rsTypes.ActiveConnection = nothing
'Put the components into another recordset and disconnect it
set rsComps = rs.NextRecordset
set rsComps.ActiveConnection = nothing

'clean up the initial recordset
rs.Close: set rs=nothing
cn.Close: set cn=nothing

'Create the dropdowns:
do until rsTypes.EOF
sCurCompType = rsTypes(0).Value
Response.Write "Component Type " & sCurCompType & ": "
Response.Write "<select name=""" & sCurCompType & """>"
rsComps.Filter="Component_Type='" & sCurCompType & "'"
do until rsComps.EOF
Response.Write "<option value-""" & rsComps(0).Value
Response.Write """>" & rsComps(2).Value
Response.Write "</option>"
rsComps.MoveNext
loop
Response.Write "</select><BR>"
rsTypes.MoveNext
loop
rsTypes.close:set rsTypes=nothing
rsComps.close:set rsComps=nothing


Thanks Bob

I'm actually using an ACCESS data base on ISS5, compleate newby, will
there be much alteration reqired?

--
We are all in the gutter, but some of us are looking at the stars.

================================================== =======================
Walrus Home alt.binaries.pictures.wallpaper <=vote here every weekend.
FAQ found at http://members.rogers.com/heretic54/
(The most up to date version is posted in alt.binaries.pictures.wallpaper
on Mondays and Thursdays. PLEASE READ BEFORE POSTING)
For Contest Archives, Artists & weekly entries
http://www.weeklywalrus.com

Jul 19 '05 #17
Kingdom wrote:
"Bob Barrows" <re******@NOyahoo.SPAMcom> wrote in
news:#n**************@tk2msftngp13.phx.gbl:

Thanks Bob

I'm actually using an ACCESS data base on ISS5, compleate newby, will
there be much alteration reqired?


A slight alteration. Access cannot handle batched queries, so you would have
to open two separate recordsets, one from each query. It would look like
this:

dim rsTypes,rsComps, strSQL
Dim sCurCompType
'open the connection, then

Set rsTypes= server.createobject("adodb.recordset")
rsTypes.cursorlocation=adUseClient
strSQL= "SELECT DISTINCT Component_Type " & _
"FROM Parts_Table ORDER BY Component_Type; "
rsTypes.Open strSQL,cn,,,adCmdText
'disconnect the recordset
set rsTypes.ActiveConnection = nothing

Set rsComps= server.createobject("adodb.recordset")
rsComps.cursorlocation=adUseClient
strSQL= "SELECT UniqueID, Component_Type, Price, Component_Name " & _
"FROM Parts_Table ORDER BY Component_Type, Component_Name"
rsComps.Open strSQL,cn,,,adCmdText
'disconnect the recordset
set rsComps.ActiveConnection = nothing
cn.Close: set cn=nothing

'The rest is unchanged
--
HTH,
Bob Barrows - ASP MVP
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Jul 19 '05 #18
Kingdom wrote:
"Bob Barrows" <re******@NOyahoo.SPAMcom> wrote in
news:#n**************@tk2msftngp13.phx.gbl:

I'm actually using an ACCESS data base on ISS5, compleate newby, will
there be much alteration reqired?


I just wanted to add that you would not want to do it this way if your table
contained thousands of rows of data. You would be better off using two
dropdowns: one for the user to select a type, the other to display the
corresponding items based on the type selected.

With a few hundred records, however, both methods should work well. Frankly,
with an Access database, I would be leaning more towards Tom's method.

--
HTH,
Bob Barrows - ASP MVP
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Jul 19 '05 #19
"Bob Barrows" <re******@NOyahoo.SPAMcom> wrote in
news:ud**************@TK2MSFTNGP09.phx.gbl:
Kingdom wrote:
"Bob Barrows" <re******@NOyahoo.SPAMcom> wrote in
news:#n**************@tk2msftngp13.phx.gbl:

I'm actually using an ACCESS data base on ISS5, compleate newby, will
there be much alteration reqired?


I just wanted to add that you would not want to do it this way if your
table contained thousands of rows of data. You would be better off
using two dropdowns: one for the user to select a type, the other to
display the corresponding items based on the type selected.

With a few hundred records, however, both methods should work well.
Frankly, with an Access database, I would be leaning more towards
Tom's method.


Thanks Bob I'll work with this and Toms tommorow and see how it shapes
up.

Wish I could learn faster!

Thanks for taking the time with this.

Jul 19 '05 #20
"Bob Barrows" <re******@NOyahoo.SPAMcom> wrote in
news:ud**************@TK2MSFTNGP09.phx.gbl:
Kingdom wrote:
"Bob Barrows" <re******@NOyahoo.SPAMcom> wrote in
news:#n**************@tk2msftngp13.phx.gbl:

I'm actually using an ACCESS data base on ISS5, compleate newby, will
there be much alteration reqired?


I just wanted to add that you would not want to do it this way if your
table contained thousands of rows of data. You would be better off
using two dropdowns: one for the user to select a type, the other to
display the corresponding items based on the type selected.

With a few hundred records, however, both methods should work well.
Frankly, with an Access database, I would be leaning more towards
Tom's method.


Couldn't wait till tomorrow, tried now but I must have messed up I'm
getting an error.

Error Type:
ADODB.Recordset (0x800A0BB9)
Arguments are of the wrong type, are out of acceptable range, or are in
conflict with one another.
/simple.asp, line 72 <========which is the end of the file?
This how it looks
<%
Set objDC = Server.CreateObject("ADODB.Connection")
objDC.Open Application("Database1_connectionstring")
%>

<%
dim rsTypes,rsComps, strSQL
Dim sCurCompType
'open the connection, then

Set rsTypes= server.createobject("adodb.recordset")
rsTypes.cursorlocation=adUseClient
strSQL= "SELECT DISTINCT Component_Type " & _
"FROM Parts_Table ORDER BY Component_Type; "
rsTypes.Open strSQL,cn,,,adCmdText
'disconnect the recordset
set rsTypes.ActiveConnection = nothing

Set rsComps= server.createobject("adodb.recordset")
rsComps.cursorlocation=adUseClient
strSQL= "SELECT UniqueID, Component_Type, Price, Component_Name " & _
"FROM Parts_Table ORDER BY Component_Type, Component_Name"
rsComps.Open strSQL,cn,,,adCmdText
'disconnect the recordset
set rsComps.ActiveConnection = nothing
cn.Close: set cn=nothing

'put the unique types into a recordset:
set rsTypes = rs.Clone
'disconnect the recordset
set rsTypes.ActiveConnection = nothing
'Put the components into another recordset and disconnect it
set rsComps = rs.NextRecordset
set rsComps.ActiveConnection = nothing

'clean up the initial recordset
rs.Close: set rs=nothing
cn.Close: set cn=nothing

'Create the dropdowns:
do until rsTypes.EOF
sCurCompType = rsTypes(0).Value
Response.Write "Component Type " & sCurCompType & ": "
Response.Write "<select name=""" & sCurCompType & """>"
rsComps.Filter="Component_Type='" & sCurCompType & "'"
do until rsComps.EOF
Response.Write "<option value-""" & rsComps(0).Value
Response.Write """>" & rsComps(2).Value
Response.Write "</option>"
rsComps.MoveNext
loop
Response.Write "</select><BR>"
rsTypes.MoveNext
loop
rsTypes.close:set rsTypes=nothing
rsComps.close:set rsComps=nothing
%>
</body>
</html>
Jul 19 '05 #21
"Tom B" <sh*****@hotmail.com> wrote in
news:eE**************@TK2MSFTNGP10.phx.gbl:
To be clear. You have a table called Parts_Table with the fields -
Component_Type, Price and a field for the name of the part, correct?

What I'd suggest you do, is to query the ENTIRE table, sorted by the
Component_Type then the Component_Name.

Set objRS = objDC.Execute("SELECT UniqueID, Component_Type, Price,
Component_Name FROM Parts_Table ORDER BY Component_Type,
Component_Name")

This will give you a recordset with all of the items in your table
sorted by component type. I'd iterate through the list and when you
hit a new Component_Type, start a new select box.

Dim sCurrentComponentType
Set objRS = 'As above
if not objRS.EOF then
sCurrentComponentType=objRS.Fields("Component_Type ").Valu
e
Response.Write "<select name=""" &
sCurrentComponentType &
""">"
Do While not objRS.EOF
if objRS.Fields("Component_Type").Value <>
sCurrentComponentType
then
sCurrentComponentType=objRS.Fields("Component_Type ").Va
lue Response.Write "</select>"
Response.Write "<select name=""" &
sCurrentComponentType &
""">"
end if
'Now the individual options

Response.Write "<option value=""" &
objRS.Fields("UniqueID").Value & """>"
objRS.MoveNext
Loop
Response.Write "</select>"
end if
Set objRS=nothing


Sorry to be such a bother but I cannot get the script to run and cannot
fathom why, Im getting getting:-

Error Type:
Microsoft VBScript compilation (0x800A0409)
Unterminated string constant
/tom.asp, line 69, column 66
Set objRS = objDC.Execute("SELECT UniqueID, Component_Type, Price,

--
We are all in the gutter, but some of us are looking at the stars.

================================================== =======================
Walrus Home alt.binaries.pictures.wallpaper <=vote here every weekend.
FAQ found at http://members.rogers.com/heretic54/
(The most up to date version is posted in alt.binaries.pictures.wallpaper
on Mondays and Thursdays. PLEASE READ BEFORE POSTING)
For Contest Archives, Artists & weekly entries
http://www.weeklywalrus.com

Jul 19 '05 #22
Kingdom wrote:
"Tom B" <sh*****@hotmail.com> wrote in
news:eE**************@TK2MSFTNGP10.phx.gbl:
Set objRS = objDC.Execute("SELECT UniqueID, Component_Type, Price,
Component_Name FROM Parts_Table ORDER BY Component_Type,
Component_Name")


Sorry to be such a bother but I cannot get the script to run and
cannot fathom why, Im getting getting:-

Error Type:
Microsoft VBScript compilation (0x800A0409)
Unterminated string constant
/tom.asp, line 69, column 66
Set objRS = objDC.Execute("SELECT UniqueID, Component_Type, Price,


You need to put the entire SQL statement on one line.

Actually, I highly recommend assigning the statement to a variable, so you
can response.write it for debugging purposes:

dim sSQL
'***all one line ************************************************** *********
sSQL = "SELECT UniqueID, Component_Type, Price, Component_Name FROM
Parts_Table ORDER BY Component_Type, Component_Name"
'***all one line ************************************************** *********
Response.write sSQL
Set objRS = objDC.Execute(sSQL,,1)

Another way to do this is to use line continuation characters:
sSQL = "SELECT UniqueID, Component_Type, Price, " & _
"Component_Name FROM Parts_Table ORDER BY " & _
"Component_Type, Component_Name"

HTH,
Bob Barrows


Jul 19 '05 #23
Kingdom wrote:
Error Type:
ADODB.Recordset (0x800A0BB9)
Arguments are of the wrong type, are out of acceptable range, or are
in conflict with one another.
/simple.asp, line 72 <========which is the end of the file?

This is caused by the failure to define the ADO constants. Here is the best
way to do that:
http://www.aspfaq.com/show.asp?id=2112

HTH,
Bob Barrows
Jul 19 '05 #24
Yes, bad me. I should have used a variable.

"Bob Barrows" <re******@NOyahoo.SPAMcom> wrote in message
news:u1**************@tk2msftngp13.phx.gbl...
Kingdom wrote:
"Tom B" <sh*****@hotmail.com> wrote in
news:eE**************@TK2MSFTNGP10.phx.gbl:
Set objRS = objDC.Execute("SELECT UniqueID, Component_Type, Price,
Component_Name FROM Parts_Table ORDER BY Component_Type,
Component_Name")
Sorry to be such a bother but I cannot get the script to run and
cannot fathom why, Im getting getting:-

Error Type:
Microsoft VBScript compilation (0x800A0409)
Unterminated string constant
/tom.asp, line 69, column 66
Set objRS = objDC.Execute("SELECT UniqueID, Component_Type, Price,


You need to put the entire SQL statement on one line.

Actually, I highly recommend assigning the statement to a variable, so you
can response.write it for debugging purposes:

dim sSQL
'***all one line

************************************************** ********* sSQL = "SELECT UniqueID, Component_Type, Price, Component_Name FROM
Parts_Table ORDER BY Component_Type, Component_Name"
'***all one line ************************************************** ********* Response.write sSQL
Set objRS = objDC.Execute(sSQL,,1)

Another way to do this is to use line continuation characters:
sSQL = "SELECT UniqueID, Component_Type, Price, " & _
"Component_Name FROM Parts_Table ORDER BY " & _
"Component_Type, Component_Name"

HTH,
Bob Barrows

Jul 19 '05 #25
Sill getting an error Tom, line 94 is end of the script, I just don't
have enough understanding yet to efectivly debug scripts but its probably
very obvious to you where I've messed up.

Error Type:
Microsoft VBScript compilation (0x800A0400)
Expected statement
/tom.asp, line 94
then
<%
Set objDC = Server.CreateObject("ADODB.Connection")
objDC.Open Application("Database1_connectionstring")
%>
<%
'To be clear. You have a table called Parts_Table with the fields -
'Component_Type, Price and a field for the name of the part, correct?

'What I'd suggest you do, is to query the ENTIRE table, sorted by the
'Component_Type then the Component_Name.

Set objRS = objDC.Execute("SELECT UniqueID, Component_Type, Price,
Component_Name FROM Parts_Table ORDER BY Component_Type, Component_Name")

Dim sCurrentComponentType
sSQL = "SELECT UniqueID, Component_Type, Price, Component_Name FROM
Parts_Table ORDER BY Component_Type, Component_Name"

then
sCurrentComponentType=objRS.Fields("Component_Type ").Value
Response.Write "<select name=""" & sCurrentComponentType
& """>"
Do While not objRS.EOF
if objRS.Fields("Component_Type").Value <>
sCurrentComponentType
then
sCurrentComponentType=objRS.Fields
("Component_Type").Value
Response.Write "</select>"
Response.Write "<select name=""" & sCurrentComponentType
& """>"
end if
'Now the individual options

Response.Write "<option value=""" &
objRS.Fields("UniqueID").Value & """>"
objRS.MoveNext
Loop
Response.Write "</select>"
end if
Set objRS=nothing
%><p></p>

Jul 19 '05 #26
Could you show the whole page?

I'm guessing that the word wrap is the problem. In VBScript, the end of the
line is a carriage return so this...

if x=1
then

is wrong and should be
if x=1 then
so in the code below....

if objRS.Fields("Component_Type").Value <> sCurrentComponentType then

needs to be all on one line.
"Kingdom" <ki*******@removehotmail.com> wrote in message
news:Xn*****************************@194.117.133.1 34...
Sill getting an error Tom, line 94 is end of the script, I just don't
have enough understanding yet to efectivly debug scripts but its probably
very obvious to you where I've messed up.

Error Type:
Microsoft VBScript compilation (0x800A0400)
Expected statement
/tom.asp, line 94
then
<%
Set objDC = Server.CreateObject("ADODB.Connection")
objDC.Open Application("Database1_connectionstring")
%>
<%
'To be clear. You have a table called Parts_Table with the fields -
'Component_Type, Price and a field for the name of the part, correct?

'What I'd suggest you do, is to query the ENTIRE table, sorted by the
'Component_Type then the Component_Name.

Set objRS = objDC.Execute("SELECT UniqueID, Component_Type, Price,
Component_Name FROM Parts_Table ORDER BY Component_Type, Component_Name")

Dim sCurrentComponentType
sSQL = "SELECT UniqueID, Component_Type, Price, Component_Name FROM
Parts_Table ORDER BY Component_Type, Component_Name"

then
sCurrentComponentType=objRS.Fields("Component_Type ").Value
Response.Write "<select name=""" & sCurrentComponentType
& """>"
Do While not objRS.EOF
if objRS.Fields("Component_Type").Value <>
sCurrentComponentType
then
sCurrentComponentType=objRS.Fields
("Component_Type").Value
Response.Write "</select>"
Response.Write "<select name=""" & sCurrentComponentType
& """>"
end if
'Now the individual options

Response.Write "<option value=""" &
objRS.Fields("UniqueID").Value & """>"
objRS.MoveNext
Loop
Response.Write "</select>"
end if
Set objRS=nothing
%><p></p>

Jul 19 '05 #27
You have to be very careful when using code from a newsgroup message. News
readers tend to put line breaks where the message composers never intended
there to be line breaks. That is why when I post code, I always try to use
line continuation characters when it looks like a line may go beyond 70
characters.

Looking at the code you've posted, let's take this section as an example:

Response.Write "<option value=""" &
objRS.Fields("UniqueID").Value & """>"

In the newsgroup post, it is showing up on two lines. It should be a single
line. The problem is: I cannot tell whether the code in your asp page
actually looks like this (in which case an error will result), or if the
line break was inserted by your news reader, making it show up as two lines
in the post.

You will need to look at the code and learn to recognize where the
inadvertant line breaks were inserted. One clue is that a line should never
end with &. Another clue is the indenting. The beginning of the above line
is indented. The part where the line break was inserted is not indented.
This is a strong clue that the text was originally written as a single line.

--
HTH,
Bob Barrows - ASP MVP
Please reply to the newsgroup. The email account listed in my From header is
my spam trap, so I don't check it very often. You will get a quicker
response by posting to the newsgroup.

"Kingdom" <ki*******@removehotmail.com> wrote in message
news:Xn*****************************@194.117.133.1 34...
Sill getting an error Tom, line 94 is end of the script, I just don't
have enough understanding yet to efectivly debug scripts but its probably
very obvious to you where I've messed up.

Error Type:
Microsoft VBScript compilation (0x800A0400)
Expected statement
/tom.asp, line 94
then

Jul 19 '05 #28
Trying to produce a page that works something like this

http://www.pc-doctors.com/frame.aspx

Sorted the "then" but now getting:-

Error Type:
Microsoft VBScript compilation (0x800A0401)
Expected end of statement
/tom.asp, line 86, column 121
sSQL = "SELECT UniqueID, Component_Type, Price, Component_Name FROM
Parts_Table ORDER BY Component_Type, Component_Name" then
---------------------------------------------------------------------------
---------------------------------------------^
Full page - called tom.asp using frontpage 2002 running ISS localy

<html>

<head>
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=windows 1252">
<title>New Page 1</title>

<meta name="Microsoft Theme" content="tp-or12 1110">
<meta name="Microsoft Border" content="tlb, default">
</head>

<body>
<%
Set objDC = Server.CreateObject("ADODB.Connection")
objDC.Open Application("Database1_connectionstring")
%>
<%
'To be clear. You have a table called Parts_Table with the fields -
'Component_Type, Price and a field for the name of the part, correct?

'What I'd suggest you do, is to query the ENTIRE table, sorted by the
'Component_Type then the Component_Name.

Set objRS = objDC.Execute("SELECT UniqueID, Component_Type, Price,
Component_Name FROM Parts_Table ORDER BY Component_Type, Component_Name")

Dim sCurrentComponentType
sSQL = "SELECT UniqueID, Component_Type, Price, Component_Name FROM
Parts_Table ORDER BY Component_Type, Component_Name" then
sCurrentComponentType=objRS.Fields("Component_Type ").Value
Response.Write "<select name=""" & sCurrentComponentType &
""">"
Do While not objRS.EOF
if objRS.Fields("Component_Type").Value <>
sCurrentComponentType then
sCurrentComponentType=objRS.Fields("Component_Type ").Value
Response.Write "</select>"
Response.Write "<select name=""" & sCurrentComponentType &
""">"
end if
'Now the individual options

Response.Write "<option value=""" &
objRS.Fields("UniqueID").Value & """>"
objRS.MoveNext
Loop
Response.Write "</select>"
end if
Set objRS=nothing
%><p></p>

</td></tr></table></body></html>

Jul 19 '05 #29
Have posted a screen snap jpg of code to alt.binaties.misc with a heading
of :-

For Tom & Bob file is called tomscode
Jul 19 '05 #30
I don't have access to that group.
"Kingdom" <ki*******@removehotmail.com> wrote in message
news:Xn*****************************@194.117.133.1 34...
Have posted a screen snap jpg of code to alt.binaties.misc with a heading
of :-

For Tom & Bob file is called tomscode

Jul 19 '05 #31
the "then" is part of an if..then statement, as in

if somecondition then
do this
end if

so your assignment statement
sSQL="blahblah"
shouldn't have a "then" at the end of it
"Kingdom" <ki*******@removehotmail.com> wrote in message
news:Xn*****************************@194.117.133.1 34...
Trying to produce a page that works something like this

http://www.pc-doctors.com/frame.aspx

Sorted the "then" but now getting:-

Error Type:
Microsoft VBScript compilation (0x800A0401)
Expected end of statement
/tom.asp, line 86, column 121
sSQL = "SELECT UniqueID, Component_Type, Price, Component_Name FROM
Parts_Table ORDER BY Component_Type, Component_Name" then
-------------------------------------------------------------------------- - ---------------------------------------------^
Full page - called tom.asp using frontpage 2002 running ISS localy

<html>

<head>
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=windows 1252">
<title>New Page 1</title>

<meta name="Microsoft Theme" content="tp-or12 1110">
<meta name="Microsoft Border" content="tlb, default">
</head>

<body>
<%
Set objDC = Server.CreateObject("ADODB.Connection")
objDC.Open Application("Database1_connectionstring")
%>
<%
'To be clear. You have a table called Parts_Table with the fields -
'Component_Type, Price and a field for the name of the part, correct?

'What I'd suggest you do, is to query the ENTIRE table, sorted by the
'Component_Type then the Component_Name.

Set objRS = objDC.Execute("SELECT UniqueID, Component_Type, Price,
Component_Name FROM Parts_Table ORDER BY Component_Type, Component_Name")

Dim sCurrentComponentType
sSQL = "SELECT UniqueID, Component_Type, Price, Component_Name FROM
Parts_Table ORDER BY Component_Type, Component_Name" then
sCurrentComponentType=objRS.Fields("Component_Type ").Value
Response.Write "<select name=""" & sCurrentComponentType &
""">"
Do While not objRS.EOF
if objRS.Fields("Component_Type").Value <>
sCurrentComponentType then
sCurrentComponentType=objRS.Fields("Component_Type ").Value
Response.Write "</select>"
Response.Write "<select name=""" & sCurrentComponentType &
""">"
end if
'Now the individual options

Response.Write "<option value=""" &
objRS.Fields("UniqueID").Value & """>"
objRS.MoveNext
Loop
Response.Write "</select>"
end if
Set objRS=nothing
%><p></p>

</td></tr></table></body></html>

Jul 19 '05 #32
Tom, is that your real e-mail address? I'd be surprised if so. Please
e-mail me privately at ray at securitynat · com.

Thanks,

Ray at work

"Tom B" <sh*****@hotmail.com> wrote in message
news:%2***************@tk2msftngp13.phx.gbl...
I don't have access to that group.
"Kingdom" <ki*******@removehotmail.com> wrote in message
news:Xn*****************************@194.117.133.1 34...
Have posted a screen snap jpg of code to alt.binaties.misc with a heading of :-

For Tom & Bob file is called tomscode


Jul 19 '05 #33
"Tom B" <sh*****@hotmail.com> wrote in
news:#L*************@tk2msftngp13.phx.gbl:
I don't have access to that group.

Hi posted current code to alt.test called it "For Tom" its a 12k gif file
this time.

The link I posted didnt show the page I wanted you to see for an idea of the
type of page I'm trying to create

http://www.pc-doctors.com select desktop from the system button then
mainstream from the middle of the page then customize and price.

Jul 19 '05 #34
"Tom B" <sh*****@hotmail.com> wrote in
news:#c*************@TK2MSFTNGP11.phx.gbl:
I've attached a zip with a little sample in it.


Thankyou Tom I appreciate you taking the time to do this for me and your
going to thinik I'm crazy because I cannot seem to connect to the DB.
It's probably very obvious what I'm doing wrong but I just don't know
what to do next.

I had been using:-
Set objDC = Server.CreateObject("ADODB.Connection")
objDC.Open Application("Database1_connectionstring")

which worked ok but don't iknow much about the OLEDB connection

The sConnectionString is all on one line

Thanks again

script
===========
<%

'Dim sConnectionString
'sConnectionString="Provider=Microsoft.Jet.OLEDB.4 .0;" &amp; "Data
Source=\fpdb\kelvindb.mdb;"" "User Id=admin;" &amp; "Password=;"

%>
<%

'FOR DEBUGGING
Dim field
for each field in Request.Form
Response.Write "<li>" & field & ": " & Request.Form
(field) & "</li>"
next
'END DEBUGGING
%>
<form method=Post action=SelectBoxes.asp>
<% call GetSelectBoxes%>
<br>
<input type=submit value=Go>
</form>

</BODY>
</HTML>
<%

Sub GetSelectBoxes()

Dim oCN
Dim oRS
Dim sSQL

sSQL="SELECT UniqueID, Component_Type, Price, Component_Name
FROM Parts_Table ORDER BY Component_Type, Component_Name"
Set oCN=CreateObject("ADODB.Connection")
oCN.Open sConnectionString
Set oRS=oCN.Execute(sSQL)
if not oRS.EOF then
Dim sCurrentBox
Dim bIsFirst
bIsFirst=true

Do While not oRS.EOF
'OK, we have our recordset.
'Let's go through each "thingy" and create a box for
it.
if sCurrentBox <> oRS.Fields("Component_Type") then

'it's time for a new select box.
'but first, let's close the last box.
if bIsFirst=false then
'make sure it's not the first select box.
Response.Write "</select><br>" & vbCrLf
else
bIsFirst=false
end if

'OK, create the new box.
sCurrentBox=oRS.Fields("Component_Type")
Response.Write sCurrentBox & ": <select
name=""" & sCurrentBox & """>" & vbCrLf
end if
'Now add the individual item
Response.Write vbTab & "<option value=""" &
oRS.Fields("UniqueID") & """>" & _
trim(oRS.Fields
("Component_Name")) & _
"</option>" & vbCrLf
oRS.MoveNext
Loop

'Let's close that last one
Response.Write "</select>" & vbCrLf

end if
Set oRS=nothing
oCN.Close
Set oCN=nothing
End Sub

%>
Jul 19 '05 #35
Those quotes aren't really there are they?
sConnectionString="Provider=Microsoft.Jet.OLEDB.4. 0;Data
Source=c:\fpdb\kelvindb.mdb;User Id=admin;Password='';"

Your Data Source needs to point to the Full path and file, so either hard
code...c:\fpdb\kelvindb.mdb or use the Server.MapPath which does it for
you....Data Source=" & Server.MapPath("\fpdb\kelvindb.mdb") & "; User
Id=admin;Password='';"

Your other choice is to use
sConnectionString=Application("Database1_connectio nstring")

"Kingdom" <ki*******@removehotmail.com> wrote in message
news:Xn****************************@194.117.133.13 4...
"Tom B" <sh*****@hotmail.com> wrote in
news:#c*************@TK2MSFTNGP11.phx.gbl:
I've attached a zip with a little sample in it.


Thankyou Tom I appreciate you taking the time to do this for me and your
going to thinik I'm crazy because I cannot seem to connect to the DB.
It's probably very obvious what I'm doing wrong but I just don't know
what to do next.

I had been using:-
Set objDC = Server.CreateObject("ADODB.Connection")
objDC.Open Application("Database1_connectionstring")

which worked ok but don't iknow much about the OLEDB connection

The sConnectionString is all on one line

Thanks again

script
===========
<%

'Dim sConnectionString
'sConnectionString="Provider=Microsoft.Jet.OLEDB.4 .0;" &amp; "Data
Source=\fpdb\kelvindb.mdb;"" "User Id=admin;" &amp; "Password=;"

%>
<%

'FOR DEBUGGING
Dim field
for each field in Request.Form
Response.Write "<li>" & field & ": " & Request.Form
(field) & "</li>"
next
'END DEBUGGING
%>
<form method=Post action=SelectBoxes.asp>
<% call GetSelectBoxes%>
<br>
<input type=submit value=Go>
</form>

</BODY>
</HTML>
<%

Sub GetSelectBoxes()

Dim oCN
Dim oRS
Dim sSQL

sSQL="SELECT UniqueID, Component_Type, Price, Component_Name
FROM Parts_Table ORDER BY Component_Type, Component_Name"
Set oCN=CreateObject("ADODB.Connection")
oCN.Open sConnectionString
Set oRS=oCN.Execute(sSQL)
if not oRS.EOF then
Dim sCurrentBox
Dim bIsFirst
bIsFirst=true

Do While not oRS.EOF
'OK, we have our recordset.
'Let's go through each "thingy" and create a box for
it.
if sCurrentBox <> oRS.Fields("Component_Type") then

'it's time for a new select box.
'but first, let's close the last box.
if bIsFirst=false then
'make sure it's not the first select box.
Response.Write "</select><br>" & vbCrLf
else
bIsFirst=false
end if

'OK, create the new box.
sCurrentBox=oRS.Fields("Component_Type")
Response.Write sCurrentBox & ": <select
name=""" & sCurrentBox & """>" & vbCrLf
end if
'Now add the individual item
Response.Write vbTab & "<option value=""" &
oRS.Fields("UniqueID") & """>" & _
trim(oRS.Fields
("Component_Name")) & _
"</option>" & vbCrLf
oRS.MoveNext
Loop

'Let's close that last one
Response.Write "</select>" & vbCrLf

end if
Set oRS=nothing
oCN.Close
Set oCN=nothing
End Sub

%>

Jul 19 '05 #36
Kingdom wrote:
"Tom B" <sh*****@hotmail.com> wrote in
news:#c*************@TK2MSFTNGP11.phx.gbl:

I cannot seem to connect to
the DB. It's probably very obvious what I'm doing wrong but I just
don't know what to do next.

I had been using:-
Set objDC = Server.CreateObject("ADODB.Connection")
objDC.Open Application("Database1_connectionstring")

which worked ok but don't iknow much about the OLEDB connection

The sConnectionString is all on one line

Thanks again

script
===========
<%

'Dim sConnectionString
'sConnectionString="Provider=Microsoft.Jet.OLEDB.4 .0;" &amp; "Data
Source=\fpdb\kelvindb.mdb;"" "User Id=admin;" &amp; "Password=;"


You need to supply the full physical path to the database. You can use
Server.MapPath. Like this:
'sConnectionString="Provider=Microsoft.Jet.OLEDB.4 .0;" & _
"Data Source=" & Server.MapPath("\fpdb\kelvindb.mdb")

Response.Write sConnectionString
You do not need to supply the user id and password attributes with an Access
database, unless you are using workgroup security.

HTH,
Bob Barrows

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Jul 19 '05 #37
"Tom B" <sh*****@NOSPAMhotmail.com> wrote in news:ugRFvJklDHA.1488
@TK2MSFTNGP12.phx.gbl:
Those quotes aren't really there are they?
sConnectionString="Provider=Microsoft.Jet.OLEDB.4. 0;Data
Source=c:\fpdb\kelvindb.mdb;User Id=admin;Password='';"

Your Data Source needs to point to the Full path and file, so either hard code...c:\fpdb\kelvindb.mdb or use the Server.MapPath which does it for
you....Data Source=" & Server.MapPath("\fpdb\kelvindb.mdb") & "; User
Id=admin;Password='';"

Your other choice is to use
sConnectionString=Application("Database1_connectio nstring")

"Kingdom" <ki*******@removehotmail.com> wrote in message
news:Xn****************************@194.117.133.13 4...
"Tom B" <sh*****@hotmail.com> wrote in
news:#c*************@TK2MSFTNGP11.phx.gbl:
> I've attached a zip with a little sample in it.
>


Thankyou Tom I appreciate you taking the time to do this for me and your going to thinik I'm crazy because I cannot seem to connect to the DB.
It's probably very obvious what I'm doing wrong but I just don't know
what to do next.

I had been using:-
Set objDC = Server.CreateObject("ADODB.Connection")
objDC.Open Application("Database1_connectionstring")

which worked ok but don't iknow much about the OLEDB connection

The sConnectionString is all on one line

Thanks again

script
===========
<%

'Dim sConnectionString
'sConnectionString="Provider=Microsoft.Jet.OLEDB.4 .0;" &amp; "Data
Source=\fpdb\kelvindb.mdb;"" "User Id=admin;" &amp; "Password=;"

%>
<%

'FOR DEBUGGING
Dim field
for each field in Request.Form
Response.Write "<li>" & field & ": " & Request.Form
(field) & "</li>"
next
'END DEBUGGING
%>
<form method=Post action=SelectBoxes.asp>
<% call GetSelectBoxes%>
<br>
<input type=submit value=Go>
</form>

</BODY>
</HTML>
<%

Sub GetSelectBoxes()

Dim oCN
Dim oRS
Dim sSQL

sSQL="SELECT UniqueID, Component_Type, Price, Component_Name
FROM Parts_Table ORDER BY Component_Type, Component_Name"
Set oCN=CreateObject("ADODB.Connection")
oCN.Open sConnectionString
Set oRS=oCN.Execute(sSQL)
if not oRS.EOF then
Dim sCurrentBox
Dim bIsFirst
bIsFirst=true

Do While not oRS.EOF
'OK, we have our recordset.
'Let's go through each "thingy" and create a box for
it.
if sCurrentBox <> oRS.Fields("Component_Type") then

'it's time for a new select box.
'but first, let's close the last box.
if bIsFirst=false then
'make sure it's not the first select box.
Response.Write "</select><br>" & vbCrLf
else
bIsFirst=false
end if

'OK, create the new box.
sCurrentBox=oRS.Fields("Component_Type")
Response.Write sCurrentBox & ": <select
name=""" & sCurrentBox & """>" & vbCrLf
end if
'Now add the individual item
Response.Write vbTab & "<option value=""" &
oRS.Fields("UniqueID") & """>" & _
trim(oRS.Fields
("Component_Name")) & _
"</option>" & vbCrLf
oRS.MoveNext
Loop

'Let's close that last one
Response.Write "</select>" & vbCrLf

end if
Set oRS=nothing
oCN.Close
Set oCN=nothing
End Sub

%>



Thanks Tom I think it must be connecting now using

<%
Dim sConnectionString
sConnectionString="Provider=Microsoft.Jet.OLEDB.4. 0;" & "Data Source=" &
Server.MapPath("\fpdb\kelvindb.mdb")

%>

but I'm getting ?

Error Type:
Microsoft JET Database Engine (0x80040E10)
No value given for one or more required parameters.
/Selectboxes.asp, line 138

I feel so helpless when it throws up errors!

Jul 19 '05 #38
What's on line 138?

"Kingdom" <ki*******@removehotmail.com> wrote in message
news:Xn*****************************@194.117.133.1 34...
"Tom B" <sh*****@NOSPAMhotmail.com> wrote in news:ugRFvJklDHA.1488
@TK2MSFTNGP12.phx.gbl:
Those quotes aren't really there are they?
sConnectionString="Provider=Microsoft.Jet.OLEDB.4. 0;Data
Source=c:\fpdb\kelvindb.mdb;User Id=admin;Password='';"

Your Data Source needs to point to the Full path and file, so either

hard
code...c:\fpdb\kelvindb.mdb or use the Server.MapPath which does it for
you....Data Source=" & Server.MapPath("\fpdb\kelvindb.mdb") & "; User
Id=admin;Password='';"

Your other choice is to use
sConnectionString=Application("Database1_connectio nstring")

"Kingdom" <ki*******@removehotmail.com> wrote in message
news:Xn****************************@194.117.133.13 4...
"Tom B" <sh*****@hotmail.com> wrote in
news:#c*************@TK2MSFTNGP11.phx.gbl:

> I've attached a zip with a little sample in it.
>

Thankyou Tom I appreciate you taking the time to do this for me and your going to thinik I'm crazy because I cannot seem to connect to the DB.
It's probably very obvious what I'm doing wrong but I just don't know
what to do next.

I had been using:-
Set objDC = Server.CreateObject("ADODB.Connection")
objDC.Open Application("Database1_connectionstring")

which worked ok but don't iknow much about the OLEDB connection

The sConnectionString is all on one line

Thanks again

script
===========
<%

'Dim sConnectionString
'sConnectionString="Provider=Microsoft.Jet.OLEDB.4 .0;" &amp; "Data
Source=\fpdb\kelvindb.mdb;"" "User Id=admin;" &amp; "Password=;"

%>
<%

'FOR DEBUGGING
Dim field
for each field in Request.Form
Response.Write "<li>" & field & ": " & Request.Form
(field) & "</li>"
next
'END DEBUGGING
%>
<form method=Post action=SelectBoxes.asp>
<% call GetSelectBoxes%>
<br>
<input type=submit value=Go>
</form>

</BODY>
</HTML>
<%

Sub GetSelectBoxes()

Dim oCN
Dim oRS
Dim sSQL

sSQL="SELECT UniqueID, Component_Type, Price, Component_Name
FROM Parts_Table ORDER BY Component_Type, Component_Name"
Set oCN=CreateObject("ADODB.Connection")
oCN.Open sConnectionString
Set oRS=oCN.Execute(sSQL)
if not oRS.EOF then
Dim sCurrentBox
Dim bIsFirst
bIsFirst=true

Do While not oRS.EOF
'OK, we have our recordset.
'Let's go through each "thingy" and create a box for
it.
if sCurrentBox <> oRS.Fields("Component_Type") then

'it's time for a new select box.
'but first, let's close the last box.
if bIsFirst=false then
'make sure it's not the first select box.
Response.Write "</select><br>" & vbCrLf
else
bIsFirst=false
end if

'OK, create the new box.
sCurrentBox=oRS.Fields("Component_Type")
Response.Write sCurrentBox & ": <select
name=""" & sCurrentBox & """>" & vbCrLf
end if
'Now add the individual item
Response.Write vbTab & "<option value=""" &
oRS.Fields("UniqueID") & """>" & _
trim(oRS.Fields
("Component_Name")) & _
"</option>" & vbCrLf
oRS.MoveNext
Loop

'Let's close that last one
Response.Write "</select>" & vbCrLf

end if
Set oRS=nothing
oCN.Close
Set oCN=nothing
End Sub

%>



Thanks Tom I think it must be connecting now using

<%
Dim sConnectionString
sConnectionString="Provider=Microsoft.Jet.OLEDB.4. 0;" & "Data Source=" &
Server.MapPath("\fpdb\kelvindb.mdb")

%>

but I'm getting ?

Error Type:
Microsoft JET Database Engine (0x80040E10)
No value given for one or more required parameters.
/Selectboxes.asp, line 138

I feel so helpless when it throws up errors!

Jul 19 '05 #39
What's on line 138?

Is it an update or an insert? If so, then you are missing a required
parameter.

If you do an update(or an insert) you have to either a) provide a value for
all fields or b) specify the fields you are providing a value for

a) INSERT INTO Parts_Table Values ('MyPartType', 'MyPartName')
b) INSERT INTO Parts_Table(Part_Type, Part_Name)
VALUES('MyPartType','MyPartName')

"Kingdom" <ki*******@removehotmail.com> wrote in message
news:Xn*****************************@194.117.133.1 34...
"Tom B" <sh*****@NOSPAMhotmail.com> wrote in news:ugRFvJklDHA.1488
@TK2MSFTNGP12.phx.gbl:
Those quotes aren't really there are they?
sConnectionString="Provider=Microsoft.Jet.OLEDB.4. 0;Data
Source=c:\fpdb\kelvindb.mdb;User Id=admin;Password='';"

Your Data Source needs to point to the Full path and file, so either

hard
code...c:\fpdb\kelvindb.mdb or use the Server.MapPath which does it for
you....Data Source=" & Server.MapPath("\fpdb\kelvindb.mdb") & "; User
Id=admin;Password='';"

Your other choice is to use
sConnectionString=Application("Database1_connectio nstring")

"Kingdom" <ki*******@removehotmail.com> wrote in message
news:Xn****************************@194.117.133.13 4...
"Tom B" <sh*****@hotmail.com> wrote in
news:#c*************@TK2MSFTNGP11.phx.gbl:

> I've attached a zip with a little sample in it.
>

Thankyou Tom I appreciate you taking the time to do this for me and your going to thinik I'm crazy because I cannot seem to connect to the DB.
It's probably very obvious what I'm doing wrong but I just don't know
what to do next.

I had been using:-
Set objDC = Server.CreateObject("ADODB.Connection")
objDC.Open Application("Database1_connectionstring")

which worked ok but don't iknow much about the OLEDB connection

The sConnectionString is all on one line

Thanks again

script
===========
<%

'Dim sConnectionString
'sConnectionString="Provider=Microsoft.Jet.OLEDB.4 .0;" &amp; "Data
Source=\fpdb\kelvindb.mdb;"" "User Id=admin;" &amp; "Password=;"

%>
<%

'FOR DEBUGGING
Dim field
for each field in Request.Form
Response.Write "<li>" & field & ": " & Request.Form
(field) & "</li>"
next
'END DEBUGGING
%>
<form method=Post action=SelectBoxes.asp>
<% call GetSelectBoxes%>
<br>
<input type=submit value=Go>
</form>

</BODY>
</HTML>
<%

Sub GetSelectBoxes()

Dim oCN
Dim oRS
Dim sSQL

sSQL="SELECT UniqueID, Component_Type, Price, Component_Name
FROM Parts_Table ORDER BY Component_Type, Component_Name"
Set oCN=CreateObject("ADODB.Connection")
oCN.Open sConnectionString
Set oRS=oCN.Execute(sSQL)
if not oRS.EOF then
Dim sCurrentBox
Dim bIsFirst
bIsFirst=true

Do While not oRS.EOF
'OK, we have our recordset.
'Let's go through each "thingy" and create a box for
it.
if sCurrentBox <> oRS.Fields("Component_Type") then

'it's time for a new select box.
'but first, let's close the last box.
if bIsFirst=false then
'make sure it's not the first select box.
Response.Write "</select><br>" & vbCrLf
else
bIsFirst=false
end if

'OK, create the new box.
sCurrentBox=oRS.Fields("Component_Type")
Response.Write sCurrentBox & ": <select
name=""" & sCurrentBox & """>" & vbCrLf
end if
'Now add the individual item
Response.Write vbTab & "<option value=""" &
oRS.Fields("UniqueID") & """>" & _
trim(oRS.Fields
("Component_Name")) & _
"</option>" & vbCrLf
oRS.MoveNext
Loop

'Let's close that last one
Response.Write "</select>" & vbCrLf

end if
Set oRS=nothing
oCN.Close
Set oCN=nothing
End Sub

%>



Thanks Tom I think it must be connecting now using

<%
Dim sConnectionString
sConnectionString="Provider=Microsoft.Jet.OLEDB.4. 0;" & "Data Source=" &
Server.MapPath("\fpdb\kelvindb.mdb")

%>

but I'm getting ?

Error Type:
Microsoft JET Database Engine (0x80040E10)
No value given for one or more required parameters.
/Selectboxes.asp, line 138

I feel so helpless when it throws up errors!

Jul 19 '05 #40
"Tom B" <sh*****@hotmail.com> wrote in
news:ei*************@TK2MSFTNGP12.phx.gbl:
What's on line 138?

Is it an update or an insert? If so, then you are missing a required
parameter.

If you do an update(or an insert) you have to either a) provide a
value for all fields or b) specify the fields you are providing a
value for

a) INSERT INTO Parts_Table Values ('MyPartType', 'MyPartName')
b) INSERT INTO Parts_Table(Part_Type, Part_Name)
VALUES('MyPartType','MyPartName')


It's just the very last line of the script %>

I haven't made any other changes other than the connection
sConnectionString

Jul 19 '05 #41
Something's odd. The code should only be 80 lines long?

"Kingdom" <ki*******@removehotmail.com> wrote in message
news:Xn*****************************@194.117.133.1 34...
"Tom B" <sh*****@hotmail.com> wrote in
news:ei*************@TK2MSFTNGP12.phx.gbl:
What's on line 138?

Is it an update or an insert? If so, then you are missing a required
parameter.

If you do an update(or an insert) you have to either a) provide a
value for all fields or b) specify the fields you are providing a
value for

a) INSERT INTO Parts_Table Values ('MyPartType', 'MyPartName')
b) INSERT INTO Parts_Table(Part_Type, Part_Name)
VALUES('MyPartType','MyPartName')


It's just the very last line of the script %>

I haven't made any other changes other than the connection
sConnectionString

Jul 19 '05 #42
Does your table look like mine?
"Kingdom" <ki*******@removehotmail.com> wrote in message
news:Xn*****************************@194.117.133.1 34...
"Tom B" <sh*****@hotmail.com> wrote in
news:ei*************@TK2MSFTNGP12.phx.gbl:
What's on line 138?

Is it an update or an insert? If so, then you are missing a required
parameter.

If you do an update(or an insert) you have to either a) provide a
value for all fields or b) specify the fields you are providing a
value for

a) INSERT INTO Parts_Table Values ('MyPartType', 'MyPartName')
b) INSERT INTO Parts_Table(Part_Type, Part_Name)
VALUES('MyPartType','MyPartName')


It's just the very last line of the script %>

I haven't made any other changes other than the connection
sConnectionString

Jul 19 '05 #43
"Tom B" <sh*****@hotmail.com> wrote in news:OuRphBxlDHA.2140
@TK2MSFTNGP09.phx.gbl:
Something's odd. The code should only be 80 lines long?


inserted into Frontpage page meta tags etc.

===========================================

<%@ Language=VBScript %>
<% Option Explicit %>
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-
1252">
<meta http-equiv="Content-Language" content="en-us">
<title>Selectbox</title>
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">

<style fprolloverstyle>A:hover {color: red; font-weight: bold}
</style>

<meta name="Microsoft Theme" content="tp-or12 1110">
<meta name="Microsoft Border" content="tlb, default">
</head>

<BODY>

<%
Dim sConnectionString
sConnectionString="Provider=Microsoft.Jet.OLEDB.4. 0;" & "Data Source=" &
Server.MapPath("\fpdb\kelvindb.mdb")
%>
<%

'FOR DEBUGGING
Dim field
for each field in Request.Form
Response.Write "<li>" & field & ": " & Request.Form
(field) & "</li>"
next
'END DEBUGGING
%>
<form method=Post action=SelectBoxes.asp>
<% call GetSelectBoxes%>
<br>
<input type=submit value=Go>
</form>

</BODY>
</HTML>
<%

Sub GetSelectBoxes()

Dim oCN
Dim oRS
Dim sSQL

sSQL="SELECT UniqueID, Component_Type, Price, Component_Name
FROM Parts_Table ORDER BY Component_Type, Component_Name,"
Set oCN=CreateObject("ADODB.Connection")
oCN.Open sConnectionString
Set oRS=oCN.Execute(sSQL)
if not oRS.EOF then
Dim sCurrentBox
Dim bIsFirst
bIsFirst=true

Do While not oRS.EOF
'OK, we have our recordset.
'Let's go through each "thingy" and create a box for
it.
if sCurrentBox <> oRS.Fields("Component_Type") then

'it's time for a new select box.
'but first, let's close the last box.
if bIsFirst=false then
'make sure it's not the first select box.
Response.Write "</select><br>" & vbCrLf
else
bIsFirst=false
end if

'OK, create the new box.
sCurrentBox=oRS.Fields("Component_Type")
Response.Write sCurrentBox & ": <select
name=""" & sCurrentBox & """>" & vbCrLf
end if
'Now add the individual item
Response.Write vbTab & "<option value=""" &
oRS.Fields("UniqueID") & """>" & _
trim(oRS.Fields
("Component_Name")) & _
"</option>" & vbCrLf
oRS.MoveNext
Loop

'Let's close that last one
Response.Write "</select>" & vbCrLf

end if
Set oRS=nothing
oCN.Close
Set oCN=nothing
End Sub

%>
Jul 19 '05 #44
I assume that the newsreader wrapped your connection string and the sql
statement?
Also, the line....
trim(oRS.Fields("Component_Name"))

Oh, I see it....There's a comma at the end of your sql statement - it
shouldn't be there.
"Kingdom" <ki*******@removehotmail.com> wrote in message
news:Xn*****************************@194.117.133.1 34...
"Tom B" <sh*****@hotmail.com> wrote in news:OuRphBxlDHA.2140
@TK2MSFTNGP09.phx.gbl:
Something's odd. The code should only be 80 lines long?


inserted into Frontpage page meta tags etc.

===========================================

<%@ Language=VBScript %>
<% Option Explicit %>
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-
1252">
<meta http-equiv="Content-Language" content="en-us">
<title>Selectbox</title>
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">

<style fprolloverstyle>A:hover {color: red; font-weight: bold}
</style>

<meta name="Microsoft Theme" content="tp-or12 1110">
<meta name="Microsoft Border" content="tlb, default">
</head>

<BODY>

<%
Dim sConnectionString
sConnectionString="Provider=Microsoft.Jet.OLEDB.4. 0;" & "Data Source=" &
Server.MapPath("\fpdb\kelvindb.mdb")
%>
<%

'FOR DEBUGGING
Dim field
for each field in Request.Form
Response.Write "<li>" & field & ": " & Request.Form
(field) & "</li>"
next
'END DEBUGGING
%>
<form method=Post action=SelectBoxes.asp>
<% call GetSelectBoxes%>
<br>
<input type=submit value=Go>
</form>

</BODY>
</HTML>
<%

Sub GetSelectBoxes()

Dim oCN
Dim oRS
Dim sSQL

sSQL="SELECT UniqueID, Component_Type, Price, Component_Name
FROM Parts_Table ORDER BY Component_Type, Component_Name,"
Set oCN=CreateObject("ADODB.Connection")
oCN.Open sConnectionString
Set oRS=oCN.Execute(sSQL)
if not oRS.EOF then
Dim sCurrentBox
Dim bIsFirst
bIsFirst=true

Do While not oRS.EOF
'OK, we have our recordset.
'Let's go through each "thingy" and create a box for
it.
if sCurrentBox <> oRS.Fields("Component_Type") then

'it's time for a new select box.
'but first, let's close the last box.
if bIsFirst=false then
'make sure it's not the first select box.
Response.Write "</select><br>" & vbCrLf
else
bIsFirst=false
end if

'OK, create the new box.
sCurrentBox=oRS.Fields("Component_Type")
Response.Write sCurrentBox & ": <select
name=""" & sCurrentBox & """>" & vbCrLf
end if
'Now add the individual item
Response.Write vbTab & "<option value=""" &
oRS.Fields("UniqueID") & """>" & _
trim(oRS.Fields
("Component_Name")) & _
"</option>" & vbCrLf
oRS.MoveNext
Loop

'Let's close that last one
Response.Write "</select>" & vbCrLf

end if
Set oRS=nothing
oCN.Close
Set oCN=nothing
End Sub

%>

Jul 19 '05 #45
Yipppeeeeeeee!!!

It's alive.

Thankyou Tom this really is apreciated, now its up and running I'll gently
and slowly add to it and learn a lot more in the process (hopefully)

I'm sure you must have got fed up with my postings, thanks again.
If there is any graphics/art work you ever need just drop me a line, I'm
much better at graphics than code and I owe you one.

Oh thanks to Bob too!

I get a feeling I'll be back soon but hopefully not with another marathon.

And just before I go, the main error I had was an underscore in my UniqueID
field, can't believe I'm so blind as not to have spotted this much ealier.

Cheers

Jul 19 '05 #46


New it wouldn't be too long before I was back.

ID : Product_Type

At the moment it writes out the UniqueID and field type.

I'd like to add the box selection and the price but not having much sucess.

So I get

ID : Product_Type : Product_Name : Price

but using the code below I still only get the first two

=====================

Dim field
Dim Price
Dim Component_Name
for each field in Request.Form
Response.Write "<li>" & Request.Form(field) & ": " &_
field & Component_Name & Price &"</li>"
next

Jul 19 '05 #47

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Filiz Duman | last post by:
I was just wondering, is it possible to write into the drop down box in order to jump to a specific item. The reason why I am asking is my drop down box has many items and additionally to the...
2
by: jagdishl | last post by:
hi I have to populate the second drop down list based on the selection made in the previous drop down list.I have to chose between two values in the first dropdown list i.e city and county.This is...
3
by: John Walker | last post by:
Hi, On an ASP.NET page I have a drop down list control. When the user pulls down the list and makes a selection, I perform validation, and if the validation fails I want the selected item in...
7
by: callawayglfr | last post by:
I am building a database in access where I have a drop down box that relates to a text box, that part I have working but when someone selects information from the first drop down I need it to limit...
6
by: mcgrew.michael | last post by:
I hope this is the right group. I am very new to ASP so this is probably a stupid question. I have some vbscript that query's AD and populates a recordset. I know the recorset contains the...
1
by: Jeff Gardner | last post by:
Greetings: I have a table with 3 pieces of data that I would like to use to dynamically populate 3 drop downs using javascript. The fields are state, orgname, office. If it's not already...
3
by: TC | last post by:
Hey All, I have some classes that I recently built for a website which uses the HttpWebRequest & HttpWebResponse objects from the System.Net namespace. Basically, the classes rap submitted data...
2
by: comerica1 | last post by:
I have the basic structure as follows: 2 drop downs A & B. A is populated using (datasource methods - from database). B is poulated using A's selected value as input and retrieve the list...
3
by: mark.norgate | last post by:
Hi Another problem... My drop down is always defaulting to selecting the first item in the drop down, even though I've got code specifically to change it to a different item: Dim adapter...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.