.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
Imran Ghani
Post New Web Links

SelectParameterS Multiple Parameters

Posted By:      Posted Date: October 04, 2010    Points: 0   Category :ASP.Net
 

Hi all! Smile So my first Post:


I want to pass to a DataSource(SQL, Linq) more than one SelectParameter or what ever will do the work.

I have many ArtistIds i want to pass to my source, so that it will display only those entries with my Parameters.

My Problem is, that i dont know in which Format i can pass more than one Parameter, till now i used QueryStrings but that only works for one Parameter, no?

I have a DataTable filled with all my IDs and im system-caching it to pass it from a Search-Site to a Detail-Site, maybe theres a better way?


This is my Source:

<asp:SqlDataSource ID="SqlDataSource1" runat="server"
            ConnectionString="<%$ ConnectionStrings:MvcMusicStoreConnectionString %>"
            SelectCommand="SELECT Album.Title, Album.Price, Album.AlbumArtUrl, Artist.Name, Genre.Name AS Expr1 FROM Album INNER JOIN Artist ON Album.ArtistId = Artist.ArtistId INNER JOIN Genre ON Album.GenreId = Genre.GenreId WHERE Album.ArtistId = @ArtistId">
       &n


View Complete Post


More Related Resource Links

Help Passing Multiple Parameters Via a URL in SSRS 2008

  
Hello Everyone, I'm totally and completely confused as to how to pass multiple paramters through a URL.  Book Online is absolutely no help because they do not offer any examples of passing multiple paramters within a URL.  Instead, I get confused over RENDER and COMMAND and what should be repeated where with each paramter and on and on and on. Here's my URL: javascript:void(window.open('http://sereporting01.wdig.com/ReportServer?%2fDOL%2fTEST%2fDisney+Sell-Through&rs:Command=Render&SiteName=Disney,InsertionType=300 x 250,Context=ROS','_blank','resizable=yes,toolbar=0,menubar=0')) What happens is that JavaScript opens a new window but I get a "Reporting Services Error".  I'm assuming it's because my URL parameters are not correct.  Can someone please just give me the correct syntax so that I can get on with my work? I'm editing this post to add - I'm also confused as to how paramters are supposed to be passed through to a report when default paramters are set up in the report which i'm trying to open with the URL.  Should I remove the default paramaters from the report or...what? Again, BOL offers no help on this issue and it just seems to generate more questions.  Thanks!!  

Passing Multiple Parameters in NavigateURL Property of Hyperlink

  
In ASP.NET 3.5, is this the only way to pass Multiple Parameters in NavigateURL Property of Hyperlink ? What about using the HyperlinkField?<asp:TemplateField HeaderText="Form Name">    <ItemTemplate>        <asp:HyperLink ID="HyperLink2" runat="server"         NavigateUrl='<%# "~/Application/" + Eval("FormType") + ".aspx?FormID=" + Eval("FormID") %>'         Text='<%# Eval("FormName") %>'>                </asp:HyperLink>     </ItemTemplate></asp:TemplateField>

SSRS 2005 WebService Programatic Multiple Parameters?

  
I am using ssrs webservices with c#. Works great until I try to pass in multiple parameters then I get: "Default value or value provided for the report parameter 'X' is not a valid value." I am at a loss - I have the split function in my stored procedure and can pass in the values like '01/05/2010,01/062010' etc no problems. I have tried wrapping the comma seperated string with single quotes and without, tried adding them as seperate inputs with no luck same response. Report works fine from SSRS interface but not when calling it using web services. Any assistance is greatly appreciated - I have done numerous web searches and found no answers. Below is the c# code snipet: //set up the parameters List<ParameterValue> input = new List<ParameterValue>(); ParameterValue pval = new ParameterValue(); pval.Name = param.Name; pval.Value = "'" + paramsSelected + "'"; input.Add(pval); //call the report service.Render( ReportName, "PDF", null, null, input.ToArray(), null, null, out encoding, out mime, out outParams, out outWarn, out outStreams);

Mapping SqlDataSource Parameters to Formview with Multiple DataKeys

  
Hi I have:a FormView that is linked to SqlDataSource1a Repeater control (inside the formview) that is linked to SqlDataSource2Thus representing a simple "1 to many" or "parent/child" relationship in the database!SqlDataSource1 is simple in that it just retrieves a straight set of records from a table and they are displayed back in the FormView (nothing special happening there). SqlDataSource2 has parameters that  filter the contents of the repeater based on the record that is shown in the Formview. This would normally be simple enough to set up by setting the parameter to the formview.selectedvalue property.HOWEVER - THE PROBLEM ARISES...The formview has multiple DataKeyNames because the table that the SqlDataSource1 links to has a compound key. So to filter the Repeater correctly SqlDataSource2 needs to map 3 parameters to 3 data key values in the formview.Any ideas how to do this?I've tried setting the SqlDataSource2 parameters to:<SelectParameters>   <asp:ControlParameter ControlID="FormView1" Name="Parameter1" PropertyName="DataKey(0)" />   <asp:ControlParameter ControlID="FormView1" Name="Parameter2" PropertyName="DataKey(1)" />   <asp:ControlParameter ControlID="FormView1" Name="Parameter3" PropertyName="DataK

Mapping SqlDataSource Parameters to Formview with multiple DataKeys

  
Hi I have:a FormView that is linked to SqlDataSource1a Repeater control (inside the formview) that is linked to SqlDataSource2Thus representing a simple "1 to many" or "parent/child" relationship in the database!SqlDataSource1 is simple in that it just retrieves a straight set of records from a table and they are displayed back in the FormView (nothing special happening there). SqlDataSource2 has parameters that  filter the contents of the repeater based on the record that is shown in the Formview. This would normally be simple enough to set up by setting the parameter to the formview.selectedvalue property.HOWEVER - THE PROBLEM ARISES...The formview has multiple DataKeyNames because the table that the SqlDataSource1 links to has a compound key. So to filter the Repeater correctly SqlDataSource2 needs to map 3 parameters to 3 data key values in the formview.Any ideas how to do this?I've tried setting the SqlDataSource2 parameters to:<SelectParameters>   <asp:ControlParameter ControlID="FormView1" Name="Parameter1" PropertyName="DataKey(0)" />   <asp:ControlParameter ControlID="FormView1" Name="Parameter2" PropertyName="DataKey(1)" />   <asp:ControlParameter ControlID="FormView1" Name="Parameter3" PropertyName="DataK

searching SQL table with multiple parameters

  
I want to query an SQL table using some Web controls to provide the parameters for filtering the records in the table. Results are displayed in a GridView. I have a TextBox with an ID of "keyword" where the user may enter one or more keywords. I'd like to search 2 columns for instances of these keywords. I also have a DropDownList named "category" that lists categories contained in a "category" column of the table. I have a dataset with a TableAdapter for the table I want to search. Got it working fine with the DropDown List but not sure how to proceed with the TextBox and keywords. What SQL query should I use? The user may not enter anything into the textbox, they may enter one word, or multiple words. This is where I am now: SELECT * FROM tablename WHERE category = @category AND ?????  

Send multiple parameters SSIS execute process task

  

Hi,

We are using Execute Process Task in SSIS package to execute a batch file to house keep the generated flat files which are older than a week from the archive folder.

The same batch file is used to delete the some temp files generated in the process.

As the Archive folder and temp folder paths are configurable, we are trying to pass the folder paths as parameters to batch file.

I used Expressions tab of Execute process Task Editor to map the variable to Arguments property. This is working fine. but I need to pass one more variable as an Argument.

Can some one help me how to achieve this. Thanks in advance.

Regards,

Sreekanth ABS

 

 


Passing multiple parameters

  
I want to be able to pass multiple parameters through DataNavigateUrlFormatString both th PONumber and ProjectCode. 
Could someone please help me?
Thanks
 
 
<asp:DetailsView ID="DetailsView8" DataSourceID="AccessDatasource8" 
        runat="server" Height="50px" Width="125px" AutoGenerateRows="False" 
        DataKeyNames="PONumber">
    <Fields>
         <asp:HyperLinkField DataNavigateUrlFields="PONumber" 
                  DataNavigateUrlFormatString="~/bringPO.aspx?PoId={0}" 
                  DataTextField="PONumber" HeaderText="PONumber" 
                  NavigateUrl="~/bringPO.aspx" Target="_blank" />

        
              <asp:BoundField DataField="PONumber" HeaderText="PoNumber" 
                  SortExpression="PONumber" HtmlEncodeFormatString="True" />
                   
                  <asp:BoundField DataField="ProjectCode" HeaderText="ProjectCode" 
                  SortExpression="ProjectCode"  HtmlEncodeForma

Problem Using Invoke and passing multiple byref parameters

  

I have code, shown below highly simplified that works all except for 1 thing: The variables being passed byRef get passed, but once modified in RecordData, they are never updated in the calling function. The calling function does not receive the updated data that is in the variables custid and amt. When debugging, I see the data in the else section of if me.invokerequired, but once it returns from the callback and is in the latter part of if me.invokerequired the data is missing.

How do I fix this?

 

Delegate Sub RecordDataCallback(ByRef custid As String, ByRef amt As Double)

Private Sub RecordData(ByRef custid As String, ByRef amt As Double)
    If Me.InvokeRequired Then
 

multiple parameters in html.actionlink

  

hello,

how can i pass multiple parameters in html.actionlink?

thanks


How to pass multiple filter parameters to moss report viewer from custom filter provider

  
Hi,

I have written a custom filter provider webpart which implements ITransformableFilterValues to pass parameter value to moss report viewer webpart.

However, this interface only allows to pass one parameter. Please can someone guide me through correct resource which allows my custom filter provider webpart to pass multiple parameters to report viewer. E.g if my report has 5 parameters then my filter provider webpart should allow me to make connection with report viewer and pass all 5 parameters.
Bhavesh

Multiple Parameters Error OLEDB MS Access SSRS

  

Hi

I have created an SSRS in BIDS 2008 with OLEDB Provider so as to access MS Access 2010 DB. My report is working fine. But the only problem is when am sending multiple parameter it raises error. I have enabled AllowMultiple Value checkbox.

ERROR : "Cannot add multi value parameter '@parametername" for DataSetName because it is not supported by the data extension".

My query is "SELECT * FROM tablename WHERE ([columnname] in (@parametername))"

Thanks in advance

 

 


how to excute SP across multiple parameters comming from checkboxlist

  

Hello sir ..

I have SP ,which accept one or more variables ..

i need to design the asp.net vb page where there will be checkboxlist , where user can check and press submit and the values will be passed throught the SP ..

here is my Code , which only accept one parameter at a time

any idea please ??

 

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click

        Dim myConnection As New SqlConnection(ConfigurationManager.ConnectionStrings("yesser_connection").ConnectionString)

        Dim myCommand As New SqlCommand("MainScript", myConnection)

        myCommand.CommandType = CommandType.StoredProcedure

        myConnection.Open()
        For Each item As ListItem In CheckBoxList1.Items
            If (item.Selected) Then
                'Create a SqlParameter object to hold the output parameter value
                myCommand.Parameters.Add("@VoterID", SqlDbType.Int)
                myCommand.Parameters("@VoterID").Value = item.Value

                Dim retValParam As New SqlParameter("@RETURN_VALUE", SqlDbType.Int)

                'IMPORTANT - must set Direction as ReturnValue 
                retValParam.Direction = ParameterDirection.ReturnValue


                'Finally, add th

Help on Stored Procedure with multiple like parameters

  

Hi All,

Please go through the screenshot below.

1

I have a table with 4 columns.The first column is a list of teams.The other three columns specify whether the team member with the particular id is present on any particular day .Say for example in the third row the running Team has 2 and 3 which means team member with the id 2 and 3 are present.Multiple values are seperated by the pipe symbol '|'.

I have a Query like this

Select Teamname from tblTeam where Running not like '%|2|%' and Running not like '%|3|%' and Running not like '%|7|%' and Biking not like '%|1|%' and Biking not like '%|4|%' and Biking not like '%|7|%' and shooting not like '%|3|%' and shooting not like '%|4|%' and shooting not like '%|7|%'

Basically i am searching the columns with like clause.The search criteria for each column may vary.In the above query i am searching for Teams where Running column does not contain 2,3 and 7,Biking column does not contain 1,4 and 7 and the shooting column does not contain 3,4 and 7.

I would like to set a stored procedure where i would be able to pass 3 set of parameters from the code behind(I am using VB.net) for Running column sear

Passing Multiple Parameters to Access Database

  
Hello,

I have had a lot of trouble passing multiple parameters from Microsoft Visual Studio 2010 to a query on a Microsoft Access 2010 database. I am coding in C# in Visual Studio. After hours of searching, I have not found a forum topic on my particular issue.

The main problem is, I do not know the number of parameters I will need to pass into to the query before I run the file (but I could potentially know this number before I run the query). Because of this, I cannot hardcode ?'s into my query and pass the corresponding number of parameters using the parameter collection class. The number of parameters I am passing depends on a file searched earlier in my code. So, I could have anywhere from one to hundreds of parameters.

One way around this problem is to call individual queries for each parameter, and compile a table based on each item returned. I would rather not do this because I want to make use of SQL’s ORDER BY function, which I know is more efficient than sorting a table using C# code after I have called the queries. 

The attempt that makes the most sense to me is to u

DAAB how to get multiple output parameters ?

  

A stored procedure is returning 2 output parameter. I tried to catch them in DAL using DAAB but couldn't succeed. Actually control did not returned on next lines. Please guide me.

 

using (DbCommand dbCommand = db.GetSqlStringCommand("p_AddLeaveApplication"))
            {
                dbCommand.CommandType = CommandType.StoredProcedure;
                db.AddInParameter(dbCommand, "@EmployeeId", DbType.Int16, leave.EmployeeId);
                db.AddInParameter(dbCommand, "@DateTo", DbType.Date,string.Format("'{0:yyyy-MM-dd HH:mm:ss}'",  leave.DateTo));
                db.AddInParameter(dbCommand, "@DateFrom", DbType.Date, string.Format("'{0:yyyy-MM-dd HH:mm:ss}'", leave.DateFrom));                    
                db.AddInParameter(dbCommand, "@LeaveType", DbType.String, leave.LeaveType);
                db.AddOutParameter(dbCommand, "@Result", DbType.Int16, 1);
                db.AddOutParameter(dbCommand, "@LeaveId", DbType.Int16, 1);
                db.ExecuteNonQuery(dbCommand);
                LeaveId = Convert.ToInt16(db.GetParameterValue(dbCommand, "@LeaveId"));
                return result = Convert.ToInt16(db.GetParameterValue(dbCommand, "@Result"));
            }


Report with Multiple Valued MDX Parameters dont work if they contain special characters

  

I have a parameter "Region" with multiple values allowed. Its Dataset is filled with the following query:

SELECT { } ON COLUMNS,
Order(
Filter(
{ ([DimIBB].[Region].[Region].ALLMEMBERS ) },
[DimIBB].[Region].CurrentMember.Name <> "Unknown"
),
[DimIBB].[Region].CurrentMember.Name,ASC)
ON ROWS
FROM [Buchhaltung]

Then I have a Dataset with Query using the above Parameter as "@DimIBBRegion" , which I use i my report:

SELECT NON EMPTY { [Measures].[Betrag Plan], [Measures].[Betrag Ist] } ON COLUMNS, NON EMPTY { ([DimPeriode].[Hierarchie].[Monat].ALLMEMBERS * [DimSachkonto].[Kontogruppen-Hierarchie].[Anzeige].ALLMEMBERS ) } DIMENSION PROPERTIES MEMBER_CAPTION, MEMBER_UNIQUE_NAME ON ROWS FROM ( SELECT ( STRTOSET(@DimIBBRegion, CONSTRAINED) ) ON COLUMNS FROM [Buchhaltung]) WHERE ( IIF( STRTOSET(@DimIBBRegion, CONSTRAINED).Count = 1, STRTOSET(@DimIBBRegion, CONSTRAINED), [DimIBB].[Region].currentmember ) ) CELL PROPERTIES VALUE, BACK_COLOR, FORE_COLOR, FORMATTED_VALUE, FORMAT_STRING, FONT_NAME, FONT_SIZE, FONT_FLAGS

The displayed text and the values for Region (first query above) are : Mitte, Nord, West, Bayern-Nord, Bayern-Süd, keiner Region zugeordnet

There are no problems for Mitte, Nord, West I can select any combination of them and everthing work. But because o

Categories: 
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend