[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Difficulty passing QueryString

Posted on 2006-11-06
5
Medium Priority
?
459 Views
Last Modified: 2008-03-06
Hello,

Can someone please give me a bit of assistance here?  For some reason, I cannot pass a querystring to a dropdown box in this manner:

<asp:SqlDataSource ID="SQLConn" runat="server" ConnectionString="<%$ ConnectionStrings:WebConn %>" SelectCommand="SELECT PO FROM tblPO WHERE PO='<% =Request.Querystring.Tostring() %>'">
        </asp:SqlDataSource>
        &nbsp;
     
        <asp:DropDownList ID="DropDownList" runat="server" DataSourceID="SQLConn" DataTextField="PO" DataValueField="PO">
        </asp:DropDownList></td>

I can see the querystring if I do this:

<%  Response.Write(Request.QueryString)%>

I can also declare it and print it:
<%  Dim X As String = Request.QueryString.ToString()
    Response.Write(X)
%>

I just cannot pass it to the select command.

Thanks in advance for your help.
0
Comment
Question by:iptrader
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 16

Accepted Solution

by:
muzzy2003 earned 1000 total points
ID: 17881930
You need to use a named querystring parameter, say "?po=xxx" and a QueryStringParameter:

<asp:SqlDataSource ID="SQLConn" runat="server" ConnectionString="<%$ ConnectionStrings:WebConn %>" SelectCommand="SELECT PO FROM tblPO WHERE PO=@PO">
                            <SelectParameters>
                                <asp:QueryStringParameter Name="PO" QueryStringField="po" Type="Int32" />
                            </SelectParameters>
</asp:SqlDataSource>

(Obviously replace the Type with whatever you need.)
0
 

Author Comment

by:iptrader
ID: 17882220
"You need to use a named querystring parameter, say "?po=xxx" and a QueryStringParameter:"

muzzy2003, can you please expand on this a bit?

Thanks
0
 
LVL 16

Expert Comment

by:muzzy2003
ID: 17882256
0
 

Author Comment

by:iptrader
ID: 17882865
Thanks for your help!
0
 
LVL 16

Expert Comment

by:muzzy2003
ID: 17882955
No problem
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question