Hi,

I'm new to Asp.net and I'm using Oracle database. I'm having no luck getting my gridview to update. When I test my update query in the datasource it updates but when I use the gridview it gives me this error "ORA-01036: illegal variable name/number".
Please help.

<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:chrhrdm %>"
        ProviderName="<%$ ConnectionStrings:chrhrdm.ProviderName %>" SelectCommand='SELECT UNIQUE_NO, SURNAME, INITIALS, DIVISION, BU_SUBAREA, EMPLOYEE_TYPE, SALARY_MODELING, APPL_GA20, LETTER_APP FROM SSU_EMPDETAILS' EnableCaching="True" UpdateCommand='UPDATE SSU_EMPDETAILS SET SALARY_MODELING = :sal, APPL_GA20 = :appl, LETTER_APP = :letter WHERE (UNIQUE_NO = :unq_no)'>
    <UpdateParameters>
        <asp:Parameter Name="sal" />
        <asp:Parameter Name="appl" />
        <asp:Parameter Name="letter" />
        <asp:Parameter Name="unq_no" />
        </UpdateParameters>
    </asp:SqlDataSource>
    &nbsp;&nbsp;
    <asp:Label ID="Label1" runat="server" Text="Please select date to view data" Width="192px"></asp:Label><br />
    <asp:DropDownList ID="ddl_PayrolDate" runat="server" AutoPostBack="True" DataSourceID="SqlDataSource2"
        DataTextField="PAYROLL_DATE" DataValueField="PAYROLL_DATE">
    </asp:DropDownList>
    <asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:chrhrdm %>"
        ProviderName="<%$ ConnectionStrings:chrhrdm.ProviderName %>" SelectCommand="SELECT DISTINCT PAYROLL_DATE FROM SDM_PERSON" UpdateCommand='UPDATE SSU_EMPDETAILS SET SURNAME = @Surname, INITIALS = @Initials'>
    </asp:SqlDataSource>
    &nbsp; &nbsp; &nbsp;&nbsp;
    <asp:GridView ID="GridView1" runat="server" DataSourceID="SqlDataSource1" AutoGenerateColumns="False" DataKeyNames="UNIQUE_NO">
              <Columns>
                  <asp:CommandField ShowEditButton="True" ShowSelectButton="True" />
                  <asp:BoundField DataField="UNIQUE_NO" HeaderText="UNIQUE_NO" ReadOnly="True" SortExpression="UNIQUE_NO" />
                  <asp:BoundField DataField="SURNAME" HeaderText="SURNAME" SortExpression="SURNAME" ReadOnly="True" />
                  <asp:BoundField DataField="INITIALS" HeaderText="INITIALS" SortExpression="INITIALS" ReadOnly="True" />
                  <asp:BoundField DataField="DIVISION" HeaderText="DIVISION" SortExpression="DIVISION" ReadOnly="True" />
                  <asp:BoundField DataField="BU_SUBAREA" HeaderText="BU_SUBAREA" SortExpression="BU_SUBAREA" ReadOnly="True" />
                  <asp:BoundField DataField="EMPLOYEE_TYPE" HeaderText="EMPLOYEE_TYPE" SortExpression="EMPLOYEE_TYPE" ReadOnly="True" />
                  <asp:BoundField DataField="SALARY_MODELING" HeaderText="SALARY_MODELING" SortExpression="SALARY_MODELING" />
                  <asp:BoundField DataField="APPL_GA20" HeaderText="APPL_GA20" SortExpression="APPL_GA20" />
                  <asp:BoundField DataField="LETTER_APP" HeaderText="LETTER_APP" SortExpression="LETTER_APP" />
        </Columns>
    </asp:GridView>

Recommended Answers

All 3 Replies

<UpdateParameters>

<asp: Parameter Name="SALARY_MODELINGl" />
<asp: Parameter Name="APPL_GA20" />

<asp: Parameter Name="LETTER_APP" />

<asp: Parameter Name="UNIQUE_NO" />
</UpdateParameters>

change parameter name like above . sortexpression and query parameter may be mismatch

Hi,

I've changed the parameter name as you did but I still get the same error.

UpdateCommand='UPDATE SSU_EMPDETAILS SET SALARY_MODELING = :sal, APPL_GA20 = :appl, LETTER_APP = :letter WHERE (UNIQUE_NO = :unq_no)'>

do u cng parameter name in here? cause i fall in same error some week ago, when i maintain name parameter name pron was solve

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.