Tell me more ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I've got a Web User Control

<asp:GridView ID="gvPodInventory" runat="server" AutoGenerateColumns="True" DataSourceID="dsIseriesPodInventory" DataKeyNames="SKU"
                AllowSorting="True" CellPadding="4" ForeColor="#333333" GridLines="Vertical" Width="2000px"  >
</asp:GridView>

Which is used in my ASPX

<asp:SqlDataSource ID="dsIseriesPodInventory" runat="server" 
        ConnectionString="<%$ ConnectionStrings:VM520ConnectionString %>" 
        ProviderName="<%$ ConnectionStrings:VM520ConnectionString.ProviderName %>"
        CancelSelectOnNullParameter="False">
</asp:SqlDataSource>

Along with a textbox for the input filter

<asp:TextBox runat="server" ID="txtSKU" ></asp:TextBox>

In the ASPX.CS the following Page_Load code

dsIseriesPodInventory.SelectCommandType = SqlDataSourceCommandType.Text;
dsIseriesPodInventory.SelectCommand = " SELECT FFSKU SKU, FFDEPT DPT " + 
                                        "FROM KIVALIB.FFINVPF " +
                                        "WHERE FFSKU in (?)";


//Build Where Parm
ControlParameter cp = new ControlParameter("SKU", TypeCode.String, "txtSKU", "Text");
cp.DefaultValue = "0";

dsIseriesPodInventory.SelectParameters.Add(cp);

This works fine and dandy if i input a single integer value into the textbox. If i put in multiple comma separated values it throws a format exception.

When I alter the .SelectCommand to specify WHERE xx IN (1234,123,15554) then nothing is displayed in the grid... even though the values are valid and in the table.

The data in the table is numeric, and i've verified the query executes just fine.

share|improve this question

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.