943,097 Members | Top Members by Rank

Ad:
  • ASP.NET Discussion Thread
  • Unsolved
  • Views: 1417
  • ASP.NET RSS
Feb 5th, 2010
-1

Gridview will not update using sqldata source

Expand Post »
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.NET Syntax (Toggle Plain Text)
  1. <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:chrhrdm %>"
  2. 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)'>
  3. <UpdateParameters>
  4. <asp:Parameter Name="sal" />
  5. <asp:Parameter Name="appl" />
  6. <asp:Parameter Name="letter" />
  7. <asp:Parameter Name="unq_no" />
  8. </UpdateParameters>
  9. </asp:SqlDataSource>
  10. &nbsp;&nbsp;
  11. <asp:Label ID="Label1" runat="server" Text="Please select date to view data" Width="192px"></asp:Label><br />
  12. <asp:DropDownList ID="ddl_PayrolDate" runat="server" AutoPostBack="True" DataSourceID="SqlDataSource2"
  13. DataTextField="PAYROLL_DATE" DataValueField="PAYROLL_DATE">
  14. </asp:DropDownList>
  15. <asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:chrhrdm %>"
  16. ProviderName="<%$ ConnectionStrings:chrhrdm.ProviderName %>" SelectCommand="SELECT DISTINCT PAYROLL_DATE FROM SDM_PERSON" UpdateCommand='UPDATE SSU_EMPDETAILS SET SURNAME = @Surname, INITIALS = @Initials'>
  17. </asp:SqlDataSource>
  18. &nbsp; &nbsp; &nbsp;&nbsp;
  19. <asp:GridView ID="GridView1" runat="server" DataSourceID="SqlDataSource1" AutoGenerateColumns="False" DataKeyNames="UNIQUE_NO">
  20. <Columns>
  21. <asp:CommandField ShowEditButton="True" ShowSelectButton="True" />
  22. <asp:BoundField DataField="UNIQUE_NO" HeaderText="UNIQUE_NO" ReadOnly="True" SortExpression="UNIQUE_NO" />
  23. <asp:BoundField DataField="SURNAME" HeaderText="SURNAME" SortExpression="SURNAME" ReadOnly="True" />
  24. <asp:BoundField DataField="INITIALS" HeaderText="INITIALS" SortExpression="INITIALS" ReadOnly="True" />
  25. <asp:BoundField DataField="DIVISION" HeaderText="DIVISION" SortExpression="DIVISION" ReadOnly="True" />
  26. <asp:BoundField DataField="BU_SUBAREA" HeaderText="BU_SUBAREA" SortExpression="BU_SUBAREA" ReadOnly="True" />
  27. <asp:BoundField DataField="EMPLOYEE_TYPE" HeaderText="EMPLOYEE_TYPE" SortExpression="EMPLOYEE_TYPE" ReadOnly="True" />
  28. <asp:BoundField DataField="SALARY_MODELING" HeaderText="SALARY_MODELING" SortExpression="SALARY_MODELING" />
  29. <asp:BoundField DataField="APPL_GA20" HeaderText="APPL_GA20" SortExpression="APPL_GA20" />
  30. <asp:BoundField DataField="LETTER_APP" HeaderText="LETTER_APP" SortExpression="LETTER_APP" />
  31. </Columns>
  32. </asp:GridView>
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Nonki is offline Offline
2 posts
since Feb 2010
Feb 6th, 2010
0
Re: Gridview will not update using sqldata source
Quote ...
<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
Reputation Points: 14
Solved Threads: 9
Junior Poster in Training
kdcorp87 is offline Offline
54 posts
since Jan 2010
Feb 8th, 2010
0
Re: Gridview will not update using sqldata source
Hi,

I've changed the parameter name as you did but I still get the same error.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Nonki is offline Offline
2 posts
since Feb 2010
Feb 8th, 2010
0
Re: Gridview will not update using sqldata source
ASP.NET Syntax (Toggle Plain Text)
  1. 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
Reputation Points: 14
Solved Threads: 9
Junior Poster in Training
kdcorp87 is offline Offline
54 posts
since Jan 2010

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in ASP.NET Forum Timeline: How to check session object is deleted or not
Next Thread in ASP.NET Forum Timeline: C#/Commented code running





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC