473,396 Members | 2,024 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Programming error

2
Expand|Select|Wrap|Line Numbers
  1. object upt;
  2.         myconn.Open();
  3.         mycmd = new SqlCommand("select CId from customer where CId='" + TextBox1.Text + "'", myconn);
  4.         upt= mycmd.ExecuteScalar();
  5.         string up = Convert.ToString(upt);
  6.         if (up == TextBox1.Text)
  7.         {
  8.             Label7.Text = "Row is Updated";
  9.         }
  10.         else
  11.         {
  12.             Label7.Text = "Row is not Updated";
  13.         }
  14.         mycmd = new SqlCommand("update customer set CName='" + TextBox2.Text + "',CAddress='" + TextBox3.Text + "',CPhone='" + TextBox4.Text + "',CEmail='" + TextBox5.Text + "',CCCardNo='" + TextBox6.Text + "'where CId='"+TextBox1.Text+"'", myconn);
  15.         mycmd.ExecuteNonQuery();
  16.         myconn.Close();
  17.         display();
  18.         clear();
  19.  
i write this code in button click event.When data is updated,

label shows "Row is not Updated". But actually it has to show "Row is Updated" msg.


But record is updated. It is showing msg only wrong. Please give me a

solution for this ASAP. Though condition is correct, it jumped to else. I'm getting confused. please help me.
Feb 25 '08 #1
2 801
MedIt
15
Try catching the exception, the exception message might give you a clue....
Feb 26 '08 #2
Plater
7,872 Expert 4TB
I would bet that if you set a break point here and looked at both values, one of them is not going to be what you think it is.
Expand|Select|Wrap|Line Numbers
  1. if (up == TextBox1.Text)
  2.  
You also might want to wait until the row is actually updated, before changing your label messages.
Feb 26 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

65
by: Roger Smythe | last post by:
A means for the progressive decomposition a problem space into increasingly simpler component parts such that these component parts represent higher levels of conceptual abstraction, and are...
4
by: Ian Lazarus | last post by:
Greetings, Is there a consensus as to the best way to report a programming error, for example an out of bounds index value passed to a function? There are three approaches that I can think of: ...
134
by: evolnet.regular | last post by:
I've been utilising C for lots of small and a few medium-sized personal projects over the course of the past decade, and I've realised lately just how little progress it's made since then. I've...
1
by: Irritable Bowel Syndrome | last post by:
Just finished off a production .NET web application written in c#. I set up a error handler in the global.asax which is triggered to iterate through the error stack and send it and other...
6
by: Martin Ortiz | last post by:
Which is best approach? Should Try + Catch be used to only deal with "catastrophic" events (like divide by zero, non-existant file, etc...etc...) Or should Try + Catch be used IN PLACE of...
81
by: Russ | last post by:
I just stumbled onto PEP 316: Programming by Contract for Python (http://www.python.org/dev/peps/pep-0316/). This would be a great addition to Python, but I see that it was submitted way back in...
270
by: jacob navia | last post by:
In my "Happy Christmas" message, I proposed a function to read a file into a RAM buffer and return that buffer or NULL if the file doesn't exist or some other error is found. It is interesting...
29
by: Martin Schmied | last post by:
Dear folks I'm looking for good sites/material for this topic: Introduction to programming, using Javascript. So, not introduction to programming *in" Javascript. Well, I guess this would be...
5
by: mangoxoxo | last post by:
Hey I'm not sure if this is where I should be asking this but I'm going to ask anyway. I'm doing an assignment for my Intro to Comp Programming class. This is the assignment: Define a class...
2
by: Netwatcher | last post by:
Hello, i am new to c++ windows and DX programming, i encountered a code in the book stated in the title, which doesn't work for a reason, here is the code // Beginning Game Programming // Chapter...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.