输入字符串的格式不正确,ORA-01465:十六进制数无效

时间:2014-06-20 06:06:21

标签: asp.net oracle10g odp.net odac

我使用的开发平台/工具: (操作系统:带SP3的XP IDE:VS2010 SP1 / ASP.NET 4.0 ADD-IN:Oracle ODT,ODAC 11.2 数据库:Oracle 10.2g


这是我昨天关注的延续(请参阅How To Insert USERID (Type: Raw, Size: 16) from Ora_aspnet_users to Another Table)。如果我将在DropDownList中使用HARDCODED用户名/用户ID,我现在能够插入Raw数据类型。但是,如果我创建一个数据源以成为DYNAMIC用户名/用户ID,它将抛出错误,如上述主题中所示。

请参阅下面标记为动态和硬编码的状态/注释:

<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>

0 个答案:

没有答案