Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Professional
Password Reminder
Register
| FAQ | Members List | Calendar | 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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #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!"
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 03:29 PM.


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