Input string was not in a correct format and ORA-01465: invalid hex number

允我心安 提交于 2019-12-11 17:26:46

问题


Development Platform/Tools I use: (OS: XP with SP3 IDE: VS2010 with SP1 / ASP.NET 4.0 ADD-IN: Oracle ODT with ODAC 11.2 Database: Oracle 10.2g


This is a continuation of my yesterday's concern (please see How To Insert USERID (Type: Raw, Size: 16) from Ora_aspnet_users to Another Table ). I am now able to insert the Raw datatype if I will use HARDCODED username/userid in DropDownList. However, if I create a Datasource to become DYNAMIC the username/userid, it will thrown error as indicated in the above subject.

Please see below status/comments marked as DYNAMIC and HARDCODED:

<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
    <asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False" DataSourceID="SqlDataSource1"
        DefaultMode="Insert" Height="50px" Width="125px">
        <Fields>
            <asp:BoundField DataField="COMMAND" HeaderText="COMMAND" SortExpression="COMMAND" />
            <asp:TemplateField HeaderText="USERNAME" SortExpression="USERID">
                <InsertItemTemplate>

<%--DYNAMIC USERNAME/USERID: If this and Insert Parameters are both uncomment, it will  thrown out "Input string was not in a correct format." 
or if this is uncomment and Insert Parameters is commented, it will thrown out "ORA-01465: invalid hex number" --%>

                    <asp:DropDownList ID="DropDownList1" runat="server" DataTextField="USERNAME" SelectedValue='<%# Bind("USERID") %>'
                        DataSourceID="SqlDataSource1" DataValueField="USERID">
                    </asp:DropDownList>

<%--HARDCODED USERNAME/USERID: If this and Insert Parameters are both uncomment, it will  thrown out "Input string was not in a correct format." 
or if this is uncomment and Insert Parameters is commented,  it will run without error" --%>

                    <asp:DropDownList ID="DropDownList1" runat="server" DataTextField="USERNAME" DataValueField="USERID"
                        SelectedValue='<%# Bind("USERID") %>'>
                        <asp:ListItem Value="FB22E2F3E536046BE040A8C02AD63318">user1</asp:ListItem>
                        <asp:ListItem Value="FB87E5B90C2A1D47E040A8C02AD62C1D">user2</asp:ListItem>
                    </asp:DropDownList>

                </InsertItemTemplate>
            </asp:TemplateField>
            <asp:CommandField ShowInsertButton="True" />
        </Fields>
    </asp:DetailsView>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
        ProviderName="<%$ ConnectionStrings:ConnectionString.ProviderName %>" SelectCommand="SELECT USERID, USERNAME FROM ORA_ASPNET_USERS"
        InsertCommand="INSERT INTO INSTRUCT(COMMAND, USERID) VALUES (:COMMAND, :USERID)">
        <InsertParameters>
            <asp:ControlParameter Name="USERID" ControlID="DetailsView1$DropDownList1" PropertyName="SelectedValue"
                Type="Byte" />
        </InsertParameters>
    </asp:SqlDataSource>
</asp:Content>

来源:https://stackoverflow.com/questions/24320916/input-string-was-not-in-a-correct-format-and-ora-01465-invalid-hex-number

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!