Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6179591
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T00:41:42+00:00 2026-05-24T00:41:42+00:00

I have a GridView that pulls the data from an Oracle DataBase dynamically. <asp:GridView

  • 0

I have a GridView that pulls the data from an Oracle DataBase dynamically.

<asp:GridView ID="gvData" runat="server" DataSourceID="DS" CellPadding="4" 
        ForeColor="#333333" AllowSorting="True" AllowPaging="True" 
        ShowFooter="True" AutoGenerateDeleteButton="True" 
        AutoGenerateEditButton="True" AutoGenerateSelectButton="True"
        OnRowDataBound="gvData_RowDataBound"
        OnSelectedIndexChanged="gvData_SelectedIndexChanged" 
        OnRowUpdating="gvData_RowUpdating" OnRowUpdated="gvData_RowUpdated"
        OnRowDeleting="gvData_RowDeleting" OnRowDeleted="gvData_RowDeleted">
        <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
        <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
        <PagerStyle BackColor="#284775" ForeColor="White" />
        <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" 
            ForeColor="#333333" />
        <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
        <EditRowStyle BackColor="#CCCCCC" />
        <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
    </asp:GridView>

    <asp:SqlDataSource ID="DS" runat="server">
    </asp:SqlDataSource>

It works fine with SELECT/INSERT/DELETE statements, however when it comes to UPDATE statement , it returns an error ORA-01036: illegal variable name/number

protected void gvData_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
    double number;
    List<string> text = new List<string>();
    List<string> pkParam = new List<string>();
    TextBox tb = new TextBox();
    LinkButton lb = new LinkButton();

    for (int i = 1; i < gvData.HeaderRow.Cells.Count; i++)
    {
        try 
        {
            lb = (LinkButton)gvData.HeaderRow.Cells[i].Controls[0];
            tb = (TextBox)gvData.Rows[e.RowIndex].Cells[i].Controls[0];

            if (tb.Text.Length > 0 && !Settings.PK.Contains(lb.Text))
                if(Double.TryParse(tb.Text.ToText(), out number))
                    text.Add(lb.Text + " = " + number);
                else
                    text.Add(lb.Text + " = " + "'" + tb.Text.ToText() + "'");
        }
        catch { }
    }

    foreach (string pk in Settings.PK)
    {
        pkParam.Add(pk + " = :" + pk);
        DS.UpdateParameters.Add(
            new Parameter(pk, TypeCode.String, e.Keys[pk].ToString()));
    }

    DS.UpdateCommand = string.Format("UPDATE {0} SET {1} WHERE {2}",
        Settings.TABLE, string.Join(",", text.ToArray()), 
            string.Join(" AND ", pkParam.ToArray()));
 }

The code of RowUpdate doesn’t really matter. I would write ANY update statement and it would return the same error.
Any ideas, folks? Thank you beforehands!

Sample query:

DS.UpdateCommand = "UPDATE ATDB.CTD_PROBLEM_EDIT_V SET CUTTING_COMMENTS = 'rrr'";

PK:

public static string[] PK = new string[] { "PROBLEM_DEPTH_MD", "API", "BUS_AREA_ID" };
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T00:41:43+00:00Added an answer on May 24, 2026 at 12:41 am

    I found my way around the problem. Not the best one but acceptable.
    Instead of DS.UpdateCommand I use OracleCommand simply ignoring Exception about setting UpdateCommand.

    protected void gvData_RowUpdated(object sender, GridViewUpdatedEventArgs e)
    {
        if (e.Exception != null)
            e.ExceptionHandled = true;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a GridView that gets it's data from the SQL database . I
I have a GridView that pulls data out of the database and populates its
I have a gridview that is displaying data from a database using LINQ to
I have GridView that allows select. It takes data from EntityDataSource . How do
hello I have a code that pulls the data to the gridview using a
I have a GridView that I need to dynamically add TemplateField elements to. My
I have a gridview that I'm trying to validate from code behind. In this
I have an ASP.NET 4.0 application that handles survey responses. I want to dynamically
I have a GridView that needs to display either x amount of columns from
I have a gridview that contains data. I want the user to be able

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.