473,503 Members | 6,354 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to update a table in database when changes are made to already existing records?

1 New Member
hi!
i have created a class 'ChangePassword' which is called from 'login' both extending jframe.
i'm trying to take a new password from the user and update the savelogin table in database Employ that contains fields username and password.

but it gives me the following error

[error]
Error:java.sql.SQLException: [Microsoft][ODBC SQL Server Driver][SQL Server]Invalid column name 'password'.

Expand|Select|Wrap|Line Numbers
  1.  
  2.  
  3.     private void btnChgSubmitActionPerformed(java.awt.event.ActionEvent evt) {                                             
  4.           newpass=jpassChgNew.getText();
  5.           confirmpass=jpassChgConfirm.getText();
  6.  
  7.        if(jpassChgOld.getText().equals(old))
  8.  
  9.        {
  10.  
  11.  if(newpass.equals(confirmpass))
  12. try{
  13.        Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
  14.        Connection con= DriverManager.getConnection("jdbc:odbc:Employ");
  15.        Statement st=con.createStatement();
  16. st.executeUpdate("update emp set password="+newpass+" where  password= "+old);
  17.  
  18.        ResultSet rs1=st.executeQuery("select * from savelogin");
  19.  
  20.        st.close();
  21.        con.close();
  22.    }
  23.     catch(Exception err)
  24.     {
  25.         System.out.println("Error:"+err);
  26.     }
  27.  
  28.        }
  29.  
  30.     }                                            
  31.  
please do answer.
sincerely
Nov 22 '10 #1
1 1489
Dheeraj Joshi
1,123 Recognized Expert Top Contributor
That means, you are not having the column "password" in the table.

Are you sure you have the column with this name? And these column names are case sensitive.

Regards
Dheeraj Joshi
Nov 23 '10 #2

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

Similar topics

1
3671
by: Google Mike | last post by:
I have one table of new records (tableA) that may already exist in tableB. I want to insert these records into tableB with insert if they don't already exist, or update any existing ones with new...
9
4741
by: Pam Ammond | last post by:
I need the code to update the database when Save is clicked and a text field has changed. This should be very easy since I used Microsoft's wizards for the OleDBAdapter and OleDBConnection, and...
3
2676
by: Alpha | last post by:
Hi, I have a datagrid and its source is a dataset. When I change information on the grid does that automatically gets change in the dataset? If not then how do I do that? I use the following...
3
1615
by: Simon | last post by:
Hi everyone, I have a small problem regarding a wizard that I'm making on my website. The wizard is obviously a series of pages that take values from the user. My question is: - Should I...
0
2075
by: jainapurva108 | last post by:
Hi, I have one table with some values as shown in below format... Column-A Column-B Column-C Column-D Column-E 11AA ------ 1234 ------ ASDF------ FIRST ------ONE 22BB ------ ...
6
2321
by: mike11d11 | last post by:
I'm trying to create an application that will have multiple users working off a table on a SQL server. Since multi users will be updating different records at any given moment, how can i get those...
1
2372
by: =?Utf-8?B?QnJhbmRvbg==?= | last post by:
Hi, I have an aspx page that contains an include section which calls an html page for text to be displayed on the aspx page. I also have an upload page that allows users to upload a simple html...
5
1344
by: tranzit | last post by:
I currently have a form with a combo box, text box and a button. When a selecetion is made from the combo box the corresponding data from the table is displayed in the text box. I want the...
1
1397
by: =?Utf-8?B?QW5kcmU=?= | last post by:
I used the wizard in VS2005 to create my connection, dataset, and tableadaptor I have a typed dataset named dsUserInfo I have a tableadaptor named taFillUserInfo I would like to on the vb side...
0
1312
by: sonia.sardana | last post by:
I m using ADODB+ SQL. Mine SQL table is create database student use student create table stu_table(roll int primary key,name varchar(10), marks int)
0
7207
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
7093
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
7291
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
7012
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
5598
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,...
1
5023
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
1522
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
748
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
402
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.