473,378 Members | 1,451 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,378 software developers and data experts.

nothing happens in update table when it executes...

Expand|Select|Wrap|Line Numbers
  1.     SqlConnection myConn = new SqlConnection();
  2.  
  3.             myConn.ConnectionString = "Data Source=192.168.15.252;Initial Catalog=TestDB;User ID=sa;Password=Pdindia123;";
  4.  
  5.             myConn.Open();
  6.  
  7.             string strqry = "UPDATE Registration SET  Password = ' " + Text2.Text + " ',PhoneNo = ' " + Text3.Text + " ', Email = '" + Text4.Text + "' WHERE (UserName = ' " + Text1.Text + " ')";
  8.  
  9.  
  10.             Response.Write("UPDATE Registration SET  Password = ' " + Text2.Text + " ',PhoneNo = ' " + Text3.Text + " ', Email = '" + Text4.Text + "' WHERE (UserName = ' " + Text1.Text + " ')");
  11.  
  12.             Label1.Text = Text3.Text;
  13.  
  14.             SqlCommand myCom = new SqlCommand(strqry, myConn);
  15.  
  16.            myCom.ExecuteNonQuery();
  17.  
  18.             myConn.Close();

No error, not Updating table... simply remains same.....

The update statement is not working in my website, no error in C# and no error in sql server. When I paste the update query into the sql query tool and replace the parameter values (+...) with real values, it updates the record.
Feb 12 '10 #1
2 1307
sashi
1,754 Expert 1GB
Dear sarvanhsr,

Try to implement exception handling [try...catch] :)
Feb 12 '10 #2
Frinavale
9,735 Expert Mod 8TB
Please take a look at the .NET articles:

How to use a database in your program part I

How to use a database in your program part II

Notice how in part I that parameters are used to create the SQL query. I recommend that you give that at try and see if it fixes the problem.

-Frinny
Feb 12 '10 #3

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

Similar topics

4
by: Karaoke Prince | last post by:
Hi There, I have an update statement to update a field of a table (~15,000,000 records). It took me around 3 hours to finish 2 weeks ago. After that no one touched the server and no...
2
by: addi | last post by:
All, Can someone help me with the following SQL and help me write it in an OPENQUERY format. I am running the following code from a SQL Server 7 box, trying to update a table in an Oracle Linked...
4
by: dp | last post by:
After looking and looking, it appears that Access ADPs graphic query designer won't display: update customer set = . from customer, where customer. = .; It comes up with the "Query...
6
by: Babu Mannaravalappil | last post by:
Can somebody please help me figure out why the following method exceptions out? Execution at the line marked with ********** hangs for about 15 seconds and then I get an error that says an...
9
by: Jeff Gardner | last post by:
Greetings: I have an UPDATE query (php 5.1.6/mysql 5.0.24a on apache 2.2) that appears to execute with no errors (php,mysql, or apache) but the data in the "UPDATED" table doesn't change. I've...
3
by: planetthoughtful | last post by:
Hi All, I'm building a Windows Form application that will use a Microsoft Access mdb file as a data store. I have a section of code that is executed when the main form is closed that _should_...
3
by: jbutler8192 | last post by:
Hello. We have a multi-user Java application that can connect to either a UniVerse database or a DB2 database on an AS400 through JDBC. The program executes a SELECT ... FOR UPDATE statement....
6
JKing
by: JKing | last post by:
I'm using an update query to update a single field in a table. Table1 is part of my normalized table structure. Table2 is used solely as an import table for raw data which I sort and summarize...
16
by: ARC | last post by:
Hello all, So I'm knee deep in this import utility program, and am coming up with all sorts of "gotcha's!". 1st off. On a "Find Duplicates Query", does anyone have a good solution for...
9
by: Jonathan Wood | last post by:
Does anyone know of any reason a button on a master page would have no effect? I have a complex HTML page that I'm converting to ASP.NET, and acknowledge I could have something odd that is...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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...

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.