Advertisement

04.29.2008 at 04:18PM PDT, ID: 23363966
[x]
Attachment Details

Working with SQLDATASOURCE  Select Parameters ASP.NET C# Grird View

Asked by sonu19 in .NET Framework 2.0, C# Programming Language, Microsoft Visual C#.Net

Tags: Microsoft, C#

Hey Guys,

I am working with Select Parameters on the .Net C# Griview.

As you can see in the code below, I am selecting from the database by passing Model and Make to the database.
What I want to do it when a user select all for the model I dont want to query with model because I will be selecting all the cars with that make.

How can I achieve this .

Thanks
Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings: GrooveCar %>"
                    SelectCommand="SELECT *,Manufacturers.mfgName as Make,dealers.companyname as companyname FROM usedcars left join Manufacturers on Manufacturers.mfgid=usedcars.mfgid left join dealers on dealers.dealerid = usedcars.dealerid where usedcars.active=1 and usedcars.mfgid=@makeid and usedcars.vindecodemodel=@model order by carid desc " >
                    <SelectParameters>
                   
                    <asp:QueryStringParameter Name="makeid" QueryStringField="makeid" />
                    <asp:QueryStringParameter Name="model" QueryStringField="model" />
                    </SelectParameters>
                </asp:SqlDataSource>
[+][-]04.29.2008 at 04:26PM PDT, ID: 21467075

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: .NET Framework 2.0, C# Programming Language, Microsoft Visual C#.Net
Tags: Microsoft, C#
Sign Up Now!
Solution Provided By: Rrooter
Participating Experts: 1
Solution Grade: A
 
 
[+][-]04.29.2008 at 04:27PM PDT, ID: 21467083

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 - Hierarchy / EE_QW_2_20070628