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 3340292
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T00:35:27+00:00 2026-05-18T00:35:27+00:00

While Updating a Field of a Grid View (which is Varchar) the updated value

  • 0

While Updating a Field of a Grid View (which is Varchar) the updated value turns out to be only the the first character of the TextBox. I’m not getting why is it happening so???
Also I’m using Stored Procedure to update.
Plz can any1 tell me the probable reasons of this error??

My C# Code is :
GridViewRow dg = gdtrng.Rows[e.RowIndex];
t1 = (TextBox)dg.Cells[2].Controls[0];
t2 = (TextBox)dg.Cells[3].Controls[0];
t3 = (TextBox)dg.Cells[4].Controls[0];
t4 = (TextBox)dg.Cells[5].Controls[0];
t5 = (TextBox)dg.Cells[6].Controls[0];
t6 = (TextBox)dg.Cells[7].Controls[0];
t7 = (TextBox)dg.Cells[8].Controls[0];
obConn.cmd.CommandType = CommandType.StoredProcedure;

    obConn.cmd.CommandText = "updatetrainingschedule";
    obConn.cmd.Parameters.AddWithValue("@tr_id", gdtrng.DataKeys[e.RowIndex].Value.ToString());
    obConn.cmd.Parameters.AddWithValue("@tr_type", t1.Text);
    obConn.cmd.Parameters.AddWithValue("@tr_subject", t2.Text);
    obConn.cmd.Parameters.AddWithValue("@tr_from", Convert.ToDateTime(t3.Text));
    obConn.cmd.Parameters.AddWithValue("@tr_to", Convert.ToDateTime(t4.Text));
    obConn.cmd.Parameters.AddWithValue("@tr_time_from", t5.Text);
    obConn.cmd.Parameters.AddWithValue("@tr_time_to", t6.Text);
    obConn.cmd.Parameters.AddWithValue("@tr_venue", t7.Text);
    obConn.conn.Open();
    obConn.cmd.ExecuteNonQuery();
    obConn.conn.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-05-18T00:35:28+00:00Added an answer on May 18, 2026 at 12:35 am

    Ok..I got the reason self. I ws using varchar instead of varchar(50)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is it possible to set UpdateCheck to LastUpdatedOn field of parent object while updating
I have a bunch of controls which need updating from another thread. While this
What sort of error is this, I mean while updating field if I use
I have encountered a weird situation while updating/upgrading some legacy code. I have a
Just installed the SDK and ADK. while updating, it gives the following error: unexpected
I have a text field in SQLite database, which I want the user to
I am have some problem in updating my qotwVote1a table's Vote1a field through PHP.
I have a field in my update form called approve which is using the
This is an extension of a question I asked a wee while ago which
In a Django form, how do I make a field read-only (or disabled)? When

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.