Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Professional
| Search | Today's Posts | Mark Forums Read
ASP.NET 2.0 Professional If you are an experienced ASP.NET programmer, this is the forum for your 2.0 questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old June 12th, 2006, 01:11 PM
Registered User
 
Join Date: May 2006
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Multiple parameters for a datagrid

I'm a asp.net newbie and still figuring out sql and have a problem that seems simple but the solution is beyond me. I'm working with Visual Web Developer 2005 Express Edition and potentially with our SQL 7.0 server. Right now I'm working with an Access 2003 database. I've been looking through the Professional & Beginning ASP.NET 2.0 books and haven't seen what I need yet (but I've probably just missed it).

I'm trying to build a page with three controls - a dropdownlist, checkboxlist and a datagrid, all populated by a SQL query. The dropdownlist is populated by Facility, the checkboxlist is filled with a field FileSection based on the Facility choice in the dropdownlist and I've built a variable, strFileSection, that is built from an iteration from the selected values of the checkbox list, e.g., 'Value1','Value3','Value5'. When I use the default choice in the Data Source wizard – the “=” operator – I only end up with a datagrid of the first choice.

What I want to do is display a datagrid with documents based on a SQL query with a WHERE statement is (Facility = FacilityChoice) AND (FileSection IN (@strFileSection)). The IN clause does not appear in the data source wizard at all so I type this in the source code like so:
.. WHERE (([Facility] = ?) AND ([FileSection] IN ( ?)) where the second parameter is <asp:QueryStringParameter Name="FileSection" QueryStringField="@strFileSection" Type="String" /> (and I'm not sure I'm using the correct parameter type).

When I run the page, the first two controls work fine but the datagrid does not display, nor are any errors displayed. I've read multiple posts in multiple forums on this problem but haven't seen a clear answer, but many answers include using SQL stored procedures and whatnot. All the examples in Professional ASP.NET 2.0 seem to have WHERE statements there the field = value and the wizard does not include the IN phrase at all. So, is this possible?
  #2 (permalink)  
Old June 14th, 2006, 09:31 AM
Authorized User
 
Join Date: Jun 2005
Location: , , Philippines.
Posts: 97
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to aldwinenriquez
Default

if you dont wna to use stored procedures you can try the parameterized query. Its also great for preventing SQL injections.

http://www.dotnetspider.com/Technolo...ticle1443.aspx

Aldwin Enriquez
"Dont you ever give up!"


Similar Threads
Thread Thread Starter Forum Replies Last Post
DataGrid/Hyperlink w multiple parameters gobotsoup ASP.NET 2.0 Basics 11 February 21st, 2007 05:49 PM
problems with multiple parameters and datagrid gobotsoup General .NET 0 February 16th, 2007 05:08 PM
FilterExpression multiple parameters/placeholders NigelBronson ASP.NET 2.0 Basics 0 September 27th, 2006 04:57 PM
2000 Multiple Parameters jpenn Reporting Services 1 July 19th, 2006 01:39 PM
How to pass multiple parameters to CR 9 syedjavid Crystal Reports 1 September 17th, 2003 05:50 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.