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

  • Home
  • SEARCH
  • 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 8066537
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T12:02:44+00:00 2026-06-05T12:02:44+00:00

this is the coe for my updation in the grid view. when i execute

  • 0

this is the coe for my updation in the grid view.
when i execute it the edit command works properly but when i click update this error pops up next to my cmd.ExecuteNonQuery();
“Failed to convert parameter value from a String to a Decimal.”
please help me here.if there is another way for me to add the details into the database plz do tell me
thanks in advance. 🙂

protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
    string v =   System.Configuration.ConfigurationManager.ConnectionStrings["harish"].ConnectionString;
    con = new OracleConnection(v);
    con.Open();


    string query = "update leave_module1 set name=:name,desig=:desig,srno=:srno,tol=:tol,compdates=:compdates,fd=:fd,td=:td,noofdays=:nod,remarks=:remarks";
    OracleCommand cmd = new OracleCommand(query, con);
        cmd.Parameters.Add(":name", OracleType.VarChar, 50).Value = GridView1.Rows[e.RowIndex].Cells[0].Text;
        cmd.Parameters.Add(":desig", OracleType.VarChar, 30).Value = GridView1.Rows[e.RowIndex].Cells[1].Text;
        cmd.Parameters.Add(":srno", OracleType.Number, 8).Value = GridView1.Rows[e.RowIndex].Cells[2].Text;
        cmd.Parameters.Add(":tol", OracleType.VarChar, 10).Value = GridView1.Rows[e.RowIndex].Cells[3].Text;
        cmd.Parameters.Add(":compdates", OracleType.VarChar, 30).Value = GridView1.Rows[e.RowIndex].Cells[4].Text;
        cmd.Parameters.Add(":fd", OracleType.DateTime).Value = GridView1.Rows[e.RowIndex].Cells[5].Text;
        cmd.Parameters.Add(":td", OracleType.DateTime).Value = GridView1.Rows[e.RowIndex].Cells[6].Text;
        cmd.Parameters.Add(":nod", OracleType.Number, 3).Value = GridView1.Rows[e.RowIndex].Cells[7].Text;
        cmd.Parameters.Add(":remarks", OracleType.VarChar, 50).Value = GridView1.Rows[e.RowIndex].Cells[8].Text;

        cmd.ExecuteNonQuery();
        ClientScript.RegisterStartupScript(Page.GetType(), "validation", "<script language='javascript'>alert('The Data has been added');window.location='Default2.aspx';</script>;");


        cmd.Dispose();
        con.Close();    
}
  • 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-06-05T12:02:46+00:00Added an answer on June 5, 2026 at 12:02 pm
    • Do not precede the named parameter with a colon (:). The .NET Framework Data Provider for Oracle supplies the colon automatically.
    • Convert parameters to relevant type before assigning to a parameter

      cmd.Parameters.Add("name", OracleType.VarChar, 50).Value = GridView1.Rows[e.RowIndex].Cells[0].Text; // this is ok 
      cmd.Parameters.Add("fd", OracleType.DateTime).Value = Convert.ToDateTime(GridView1.Rows[e.RowIndex].Cells[5].Text);
      cmd.Parameters.Add("nod", OracleType.Number, 3).Value = Convert.ToDecimal(GridView1.Rows[e.RowIndex].Cells[7].Text);
      
    • Use Using block

      here is sample code

      using (var connection = new OracleConnection(connectionString))
      {
          connection.Open();
          using (var command = new OracleCommand(queryString, connection))
          {
             // add parameters here 
             command.ExecuteNonQuery();
          }
      
       }
      
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This works. $(document).ready(function(){ $(.items article).click(function(){ window.location=$(this).find(a).attr(href); return false; }); }); However , when the
This works fine, but I want to make it prettier - and accommodate all
This code below allows me to find the word error in all my files
m having this coe....could any one tell me how can i print it on
This is in regards to merge XCode project.pbxproj files, but the same principle applies
This has been asked several times, i know, but help me understand something. You
This question is related to hooking with Mobile Substrate, but as long as you
This is what i tried . In my view.py file , import logging logger
This question was posted on StackApps , but the issue may be more a
This seems 101-level, but I can't find an answer! (instead I find links to

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.