Newbie here, having fun querying database thru web pages but I have a
problem:

I have a query string returned containing the names of some
checkboxes:
Checkbox=CompanyName, ContactName

Then I execute the query string on this database:
Set objRS=adodbConn.Execute(strQuery)

How can I break this query string into 2 seperate strings so I can get
the records using this?:
Response.Write objRS( the two strings)

Note: there could be more than 2 checkboxes returned in the query
string.

Thanks in advance for any help.

Re: Newbie needs help with Query String by Ray

Ray
Wed Feb 04 22:00:29 CST 2004

Are you currently just using Request.Querystring by itself? If so, this is
how you can/should use the querystring collection:


http://yoursite/page.asp?a=3&b=4

<%
Dim a, b
side1 = Request.Querystring("a")
side2 = Request.Querystring("b")

Response.Write "The length of the hypotenuse of this right triangle is " &
CStr((side1^2 + side2^2)^.5) & "."
%>

--

Ray at home
Microsoft ASP MVP


<sdeyoreo@hotmail.com> wrote in message
news:nvd320dpregjccjm7hiec5vllor66iqm23@4ax.com...
> Newbie here, having fun querying database thru web pages but I have a
> problem:
>
> I have a query string returned containing the names of some
> checkboxes:
> Checkbox=CompanyName, ContactName
>
> Then I execute the query string on this database:
> Set objRS=adodbConn.Execute(strQuery)
>
> How can I break this query string into 2 seperate strings so I can get
> the records using this?:
> Response.Write objRS( the two strings)
>
> Note: there could be more than 2 checkboxes returned in the query
> string.
>
> Thanks in advance for any help.
>



Re: Newbie needs help with Query String by Ray

Ray
Wed Feb 04 22:19:44 CST 2004

Okay, maybe I read your question too fast. Sorry. Are you talking about
when you have multiple checkboxes with the same name? How do you go through
the values when they're all the same name?

<%
Dim i,iMax
iMax = Request.Querystring("Checkbox").Count
For i = 1 To iMax
Response.Write Request.Querystring("Checkbox")(i) & "<br>"
Next
%>

Thank you Chris Hohmann. :]

--

Ray at home
Microsoft ASP MVP


<sdeyoreo@hotmail.com> wrote in message
news:nvd320dpregjccjm7hiec5vllor66iqm23@4ax.com...
> Newbie here, having fun querying database thru web pages but I have a
> problem:
>
> I have a query string returned containing the names of some
> checkboxes:
> Checkbox=CompanyName, ContactName
>
> Then I execute the query string on this database:
> Set objRS=adodbConn.Execute(strQuery)
>
> How can I break this query string into 2 seperate strings so I can get
> the records using this?:
> Response.Write objRS( the two strings)
>
> Note: there could be more than 2 checkboxes returned in the query
> string.
>
> Thanks in advance for any help.
>



Re: Newbie needs help with Query String by sdeyoreo

sdeyoreo
Wed Feb 04 22:43:05 CST 2004

On Wed, 4 Feb 2004 23:19:44 -0500, "Ray at <%=sLocation%> [MVP]"
<myFirstNameATlane34dotKOMM> wrote:

>Okay, maybe I read your question too fast. Sorry. Are you talking about
>when you have multiple checkboxes with the same name? How do you go through
>the values when they're all the same name?
>
><%
>Dim i,iMax
>iMax = Request.Querystring("Checkbox").Count
>For i = 1 To iMax
> Response.Write Request.Querystring("Checkbox")(i) & "<br>"
>Next
>%>
>
>Thank you Chris Hohmann. :]

I have multiple checkboxes with the same name, checkbox. Each has a
different value = <%=column.name%>
This is how I make all the checkboxes:

<%For Each column in table.columns%>
<INPUT TYPE="checkbox" Name="checkbox" VALUE="<%=column.name%>"
<%Next%>

Now I need to break the querystring into the individual checkbox
values to use in: Response.Write objRS( checkbox value ).

I think I can use InStr to find the commas and Left() and Right() to
get the individual strings. Something like this:

' Parse string of commas
Response.Write ("first comma is at:"&InStr( strCheckbox, ","))
Response.Write(Left(strCheckbox,InStr( strCheckbox, ",")-1))
Response.Write(Right(strCheckbox,InStr( strCheckbox, ",")))

But there could be any number of checkboxes, so I'll have to keep
removing the Left() from the string and parsing whats left over till
it's done. Complicated. Is there a nicer way?

Re: Newbie needs help with Query String by Ray

Ray
Wed Feb 04 22:48:31 CST 2004

Did you try the code I posted in my second reply? It will do just what
you're asking.

--

Ray at home
Microsoft ASP MVP


<sdeyoreo@hotmail.com> wrote in message
news:voh3209ah58g8agkt142goumg34bt29efk@4ax.com...
> On Wed, 4 Feb 2004 23:19:44 -0500, "Ray at <%=sLocation%> [MVP]"
> <myFirstNameATlane34dotKOMM> wrote:
>
> >Okay, maybe I read your question too fast. Sorry. Are you talking about
> >when you have multiple checkboxes with the same name? How do you go
through
> >the values when they're all the same name?
> >
> ><%
> >Dim i,iMax
> >iMax = Request.Querystring("Checkbox").Count
> >For i = 1 To iMax
> > Response.Write Request.Querystring("Checkbox")(i) & "<br>"
> >Next
> >%>
> >
> >Thank you Chris Hohmann. :]
>
> I have multiple checkboxes with the same name, checkbox. Each has a
> different value = <%=column.name%>
> This is how I make all the checkboxes:
>
> <%For Each column in table.columns%>
> <INPUT TYPE="checkbox" Name="checkbox" VALUE="<%=column.name%>"
> <%Next%>
>
> Now I need to break the querystring into the individual checkbox
> values to use in: Response.Write objRS( checkbox value ).
>
> I think I can use InStr to find the commas and Left() and Right() to
> get the individual strings. Something like this:
>
> ' Parse string of commas
> Response.Write ("first comma is at:"&InStr( strCheckbox, ","))
> Response.Write(Left(strCheckbox,InStr( strCheckbox, ",")-1))
> Response.Write(Right(strCheckbox,InStr( strCheckbox, ",")))
>
> But there could be any number of checkboxes, so I'll have to keep
> removing the Left() from the string and parsing whats left over till
> it's done. Complicated. Is there a nicer way?



Re: Newbie needs help with Query String by sdeyoreo

sdeyoreo
Thu Feb 05 08:45:36 CST 2004

I haven't yey. It was late at night. Now it's early in the morning so
i'lltry it soon. Thanks for your help, I really appriciate it. Like i
said, this ASP is really NEAT!
On Wed, 4 Feb 2004 23:48:31 -0500, "Ray at <%=sLocation%> [MVP]"
<myFirstNameATlane34dotKOMM> wrote:

>Did you try the code I posted in my second reply? It will do just what
>you're asking.


Re: Newbie needs help with Query String by Ray

Ray
Thu Feb 05 09:01:08 CST 2004


<sdeyoreo@hotmail.com> wrote in message
news:7ml420pr48d3vhdoda3i518ka2a9fcm6no@4ax.com...
> Like i said, this ASP is really NEAT!

You're right. It really is. :] Your enthusiasm is quite refreshing and
encouraging!

Ray at work



Re: Newbie needs help with Query String by sdeyoreo

sdeyoreo
Thu Feb 05 13:11:32 CST 2004

Hi, this is what Idid and it works great!! I so thrilled!!!:

' Get records in requested fields:
While Not objRS.EOF
For i = 1 To Request.Querystring("Checkbox").Count
Response.Write objRS(Request.Querystring("Checkbox")(i) )
Next
Response.Write("<BR>")
objRS.MoveNext
Wend

Thanks again !!!
On Thu, 5 Feb 2004 10:01:08 -0500, "Ray at <%=sLocation%> [MVP]"
<myfirstname at lane34 dot com> wrote:

>
><sdeyoreo@hotmail.com> wrote in message
>news:7ml420pr48d3vhdoda3i518ka2a9fcm6no@4ax.com...
>> Like i said, this ASP is really NEAT!
>
>You're right. It really is. :] Your enthusiasm is quite refreshing and
>encouraging!
>
>Ray at work
>


Re: Newbie needs help with Query String by Ray

Ray
Thu Feb 05 13:14:53 CST 2004


<sdeyoreo@hotmail.com> wrote in message
news:065520p7rpqkvclemiigtbm12q7iafdu5g@4ax.com...
> Hi, this is what Idid and it works great!! I so thrilled!!!:

I really love the enthusiasm! It reminds me of when I still had the ability
to care about things. :]

Ray at work



Re: Newbie needs help with Query String by sdeyoreo

sdeyoreo
Thu Feb 05 15:58:40 CST 2004

I'm 51 yrs old. I still get thrilled!
On Thu, 05 Feb 2004 14:11:32 -0500, sdeyoreo@hotmail.com wrote:

>Hi, this is what Idid and it works great!! I so thrilled!!!:
>
>' Get records in requested fields:
>While Not objRS.EOF
> For i = 1 To Request.Querystring("Checkbox").Count
> Response.Write objRS(Request.Querystring("Checkbox")(i) )
> Next
> Response.Write("<BR>")
> objRS.MoveNext
>Wend
>
>Thanks again !!!
>On Thu, 5 Feb 2004 10:01:08 -0500, "Ray at <%=sLocation%> [MVP]"
><myfirstname at lane34 dot com> wrote:
>
>>
>><sdeyoreo@hotmail.com> wrote in message
>>news:7ml420pr48d3vhdoda3i518ka2a9fcm6no@4ax.com...
>>> Like i said, this ASP is really NEAT!
>>
>>You're right. It really is. :] Your enthusiasm is quite refreshing and
>>encouraging!
>>
>>Ray at work
>>