954,174 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Gridview will not update using sqldata source

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>
    <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>
Nonki
Newbie Poster
2 posts since Feb 2010
Reputation Points: 10
Solved Threads: 0
 

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

kdcorp87
Junior Poster in Training
54 posts since Jan 2010
Reputation Points: 14
Solved Threads: 9
 

Hi,

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

Nonki
Newbie Poster
2 posts since Feb 2010
Reputation Points: 10
Solved Threads: 0
 
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

kdcorp87
Junior Poster in Training
54 posts since Jan 2010
Reputation Points: 14
Solved Threads: 9
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You