locked
oracle : SqlDataSource : parameter mismatch RRS feed

  • Question

  • User1810039979 posted

    I'm trying to pass a parameter into a query to an oracle database.  I want to enter a value into a textbox and pass it in to the query

    Here's the relevant snippet of .net code & my query

    1            <asp:SqlDataSource ID="SqlDataSource4" runat="server" ConnectionString="<%$ ConnectionStrings:My_Connection_String %>"
    2                ProviderName="<%$ ConnectionStrings:My_Connection_String.ProviderName %>" SelectCommand="SELECT m.GROUPID, m.INDID FROM MYMAP.MAP_M m WHERE (m.GROUPID = :gimme)">
    3                <SelectParameters>
    4                    <asp:ControlParameter ControlID="TextBox1" DefaultValue="ABC123" Name="gimme" PropertyName="Text"
    5                        Type="String" />
    6                </SelectParameters>
    7            </asp:SqlDataSource>
    8            <asp:GridView ID="GridView4" runat="server" DataSourceID="SqlDataSource4">
    9            </asp:GridView>
    

    Here is the error message I get...

    ORA-12704: character set mismatch

    I know that the problem is from the WHERE (m.GROUPID = :gimme) portion of the query.  GROUPID is varchar(10).  What can I do to pass this value in? 

    Ideally, I would like the WHERE clause to be of the format WHERE (m.GROUPID LIKE :gimme + '%').  Any suggestions?  Thanks.

    Thursday, September 13, 2007 10:44 AM

Answers

  • User-2005691517 posted

     Try using Type="Empty" for the parameter

    <SelectParameters>
    <asp:ControlParameter ControlID="TextBox1" DefaultValue="ABC123" Name="gimme" PropertyName="Text"
    Type="Empty" />
    </SelectParameters>

     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, September 13, 2007 11:30 AM

All replies

  • User-2005691517 posted

     Try using Type="Empty" for the parameter

    <SelectParameters>
    <asp:ControlParameter ControlID="TextBox1" DefaultValue="ABC123" Name="gimme" PropertyName="Text"
    Type="Empty" />
    </SelectParameters>

     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, September 13, 2007 11:30 AM
  • User1810039979 posted

    Awesome!  Thanks a lot Prashant. [<:o)]

     -steve

    Thursday, September 13, 2007 11:38 AM
  • User1914641560 posted

    Thank you so much! I had type "String" which sounded locigical but using "Empty" solved my problem.

    Friday, November 11, 2011 3:08 PM