Quantcast
Viewing all articles
Browse latest Browse all 20

Re: dynamic Filter ( Using multiple drop down list)

Montadar

Ok. after I analyzed the issue. it was not because of DataSet dataSet = null; an error was due to the parameters that are passing from the code behind to the stored procedure do not match. stored procedure expected to have (one campaignId, one campaign name, and either single segment or multiple segments that are associated with campaingId).

The 'crash' is because dataSet is null. The code willl always go through the finally and if dataSet is not initialised (if an exception occures), you will have the problem. The fact that something else caused the exception is not relevant.

Further I have a bit of a problem understanding why / how you modified my original code to get the segments and add them to the query. A line like below does not make sense to me.

lbSegments.Text = @segment;

I can't test this, but below basically should be working

// get selected segments
int[] selectedsegments = lbSegments.GetSelectedIndices();
// add selected segments to s
for (int cnt = 0; cnt < selectedsegments.Length; cnt++)
{
    s += lbSegments.Items[selectedsegments[cnt]].Text + ",";
}

selectCommand.Parameters.AddWithValue("@segment", s);


Viewing all articles
Browse latest Browse all 20

Trending Articles