Gridview Rowupdating

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Nonki
    New Member
    • Feb 2010
    • 5

    Gridview Rowupdating

    Hi,

    Can someone help me to correct my code to make my Gidview update.

    Here is my code below:
    Code:
    protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            string unqNo = GridView1.DataKeys[e.RowIndex].Value.ToString();
            string salMod = GridView1.Rows[e.RowIndex].Cells[6].Text;
            string applGa20 = GridView1.Rows[e.RowIndex].Cells[7].Text;
            string updateQuery = string.Format("UPDATE SSU_EMPDETAILS SET SALARY_MODELING = '{0}',APPL_GA20='{1}' WHERE UNIQUE_NO = {3}",salMod,applGa20,unqNo);
            GridView1.EditIndex = -1;
            BindData(updateQuery);
      }
    
    private void BindData(string Query)
        {
            OracleConnection oCon = new OracleConnection("Data Source=PSM1;User ID=C****DM;Password=C****DM");
            OracleCommand oCmd = oCon.CreateCommand();
    
            oCmd.CommandText = "Select * from SSU_EMPDETAILS";
    
    
            oCmd.CommandType = CommandType.Text;
    
            OracleDataAdapter oDa = new OracleDataAdapter(oCmd);
            System.Data.DataSet oDs = new DataSet();
            oDa.Fill(oDs);
            GridView1.DataSource = oDs;
            GridView1.DataBind();
        }
    Last edited by Frinavale; Feb 17 '10, 02:17 PM. Reason: Please post code in [code] ... [/code] tags. Added code tags.
  • Frinavale
    Recognized Expert Expert
    • Oct 2006
    • 9749

    #2
    I don't know what you are doing.
    You are passing a String into your DataBind method...the string contains the SQL query that I'm assuming will update your table....but you never use it.

    Why?

    -Frinny

    Comment

    • Nonki
      New Member
      • Feb 2010
      • 5

      #3
      Hi,

      Thanks foe viewing my code but I have changed it completely, not using it anymore.

      Comment

      • CroCrew
        Recognized Expert Contributor
        • Jan 2008
        • 564

        #4
        So, is your question answered?

        If not could you provide more information on what exactly you are trying to accomplish and what your current results are with the code you have.

        Thanks,
        CroCrew~

        Comment

        Working...