Home Answers Viewqa SQL updating a table in a database

 
 


raman
updating a table in a database
1 Answer(s)      2 years and 10 months ago
Posted in : SQL

give me complete source code in java to execute the sqlquery such that
(update table_name set phone no=? where cous_id=?). or in simple way give me source code to update my table in MsAccess with new values.
View Answers

July 29, 2010 at 12:05 PM


Hi Friend,

Try the following code:

import java.sql.*;
import java.util.*;
class UpdateTable{
public static void main(String[] args)
{
Scanner input=new Scanner(System.in);
System.out.print("Enter Name: ");
String v1=input.nextLine();
System.out.print("Enter Address: ");
String v2=input.nextLine();
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con = DriverManager.getConnection("jdbc:odbc:access");
Statement st = con.createStatement();
int c = st.executeUpdate("update data set name='"+v1+"',address='"+v2+"' where id=4");
System.out.println("1 row affected");
st.close();
con.close();
}


catch(Exception e){
System.out.println(e);
}

}

}

Thanks









Related Pages:
updating a table in a database - SQL
updating a table in a database  give me complete source code in java to execute the sqlquery such that (update table_name set phone no=? where cous_id=?). or in simple way give me source code to update my table in MsAccess
Updating user profile
Updating user profile  how should i provide user to update his... fileds   The given code retrieve data from database and display in the html table. At each row, there is a button which consists of that particular id
Lock while inserting/updating database in multithreaded.
Lock while inserting/updating database in multithreaded.  Hi, I am having a multithreaded process which replicates the data from many table to one... inserting/updating to database. I dont know what is the issue but it was never
Updating Ms Access Database using jsp - JSP-Servlet
Updating Ms Access Database using jsp  Hi I am new to jsp and I am trying to update a record in an access database. I only want to update part... a table product(prod_id,prod_name,quantity,price) and try the following code
updating column automatically based on system date
updating column automatically based on system date  hi, can any one give solution for my question i have a table called leave balanced(leave-id... the database to update the value at the end of month. Instead write a program
iBatis Update -Updating data of a table
iBatis Update -Updating data of a table   ... are updating table with an id as specified in our parameter and therefore... and essential feature for any database application. In this iBatis tutorial we have already
Updating using AngularJS
one more button for updating items in the table for Updating Items...Updating using AngularJS  Shopping.html <!DOCTYPE HTML PUBLIC...;br /> <table border="1"> <thead>
updating an access database with visual basic 2010
updating an access database with visual basic 2010  I am building a program in visual basic 2010 that connects to an access database. I was wondering if you could help me figure out the code for the save button. When
Updating multiple value depending on checkboxes
Updating multiple value depending on checkboxes  Hi .. I want to Update the multiple values of database using checkboxes and want to set the session for selected checkboxes..? please answer if any one knows as soon as possible
Problem in updating query in Hibernate - Hibernate
Problem in updating query in Hibernate  Hi, I have used a query to update the existing columns of one table. The query updates the records in the main table but it does not update the tables that are mapped from the main table
table
input from oracle table(my database table..) This is a very important table of my
what is wrong with my JSP codes for updating a form?
what is wrong with my JSP codes for updating a form?  Hi experts, I have tried to emulate a code from a textbook but it doesn't work in my program... database as follows:- ID - autoincrement and it's INT. NRIC No - String
Creating a Database Table
Creating a Database Table     ... the same database in many different ways.  Table: A table is basic component... and it's description that helps you to create a database table by using java file. Brief
updating rows which contains same id, different value for each row
updating rows which contains same id, different value for each row  Student table: sid name age 3... 30 From the above table we can identify that 4 rows with sid 1 and 3
inserting dropdown values into database table
inserting dropdown values into database table   hi i want to insert dropdown values into a database table by using jsp
Designing a Database with a junction table or without it?
Designing a Database with a junction table or without it?  Designing a group of table with, where many tables reference single parent table. In that case is it a better option to create a junction table to maintain
DATABASE
DATABASE  I can't send different information from different form into a single table in my database
coding for updating profile
coding for updating profile  coding for updating profile
database
database  I wanted to know if it is possible to take the fields of a table from a user and then create a table in mysql database......im doing my project in swings netbeans Plz help me ThankYou
database
database  Is it possible to let the user first type the database and table name in textfields and then provide him a taxt area to type an insert query to insert data in that table and then execute the query.....The project
Database
Database   select * from student i am not asking this.i am asking about that the command line code like create table student(..........) like this way
Create Dynamic Table using Hubernate
Create Dynamic Table using Hubernate  Thank's for reading my Post. I...: How to create seperate table for all users they sign up for my web app. i need to create 2 table's 1.User Details - Store user mail address,username
database
database  Im doing my project in java swings...netbeans I wanted java source code to establish connection to postgresql_8.1 using jdbc and create a user defined database and a table in that database and insert values Plz help me
database
database  In my project,i want the user to specify the name of the database he wants to create in mysql and then also the name of the table along with the column names he wants in that database....Im doing my project in netbeans
Database
Database  from java code i have to retrieve some data from a database, which is present in a different timezone. Scenario :- My database... in database timezone is 9PM 15APR2012. I want to retrieve something from database
redeploy project update database table
redeploy project update database table  **Dear Sir, i am using Hibernate 3.3 and spring 3.0 and mysql database. Now while redeploying project In tomcat 6 i want to run a sql query Thanks for your wise comments
database
the names of the databases present in mysql database on a Jlist that is already present on the gui and when the user selects a particular database,the tables present under that database should be displayed on another Jlist which is present
database
database  I want to let the user select one of the database type... give the name of the database name that he want to create in a textfield,then the name of the table and the fields that he wants to create in the respective
database
. The given code retrieve table names and their fields from the particular database...database  how to get information about database like, what are the names of tables that database includes ? what are the names of fields
database
database  Im doing project in netbeans swings......you helped me to create a table with user defined column names.....i wanted to know if it is possible to let the user insert his data into that table.....Plz help me
Database
Database  i want to store the uploaded video and image for this which datatype we want to use in creation of the table in MySQL   You have to use 'longblob' datatype CREATE TABLE `file
Database
Database  I want to bring all rows from 11 tables primary key is same for all the eleven table..please help me
Database
Database  in my database i insert the first name and last name as('abc','def')but it gives error.plz send me the query how can we insert the first...,we have created a table named 'student': CREATE TABLE `student
Database
Database  in my database i insert the first name and last name as('abc','def')but it gives error.plz send me the query how can we insert the first...,we have created a table named 'student': CREATE TABLE `student
database
database   when i am writing this code CREATE TABLE student...; Have you run this query directly into the Mysql database? Here it works properly.   Have you run this query directly into the Mysql database? Here
Copy Table in a MySQL Database
Copy Table in a MySQL Database     ... one table to another in a same MySQL database. To copy any table,  firstly... CopyOneTableToAnother Copy data from one table to another in a database! 2
Database
Database  In MySQL table i am adding the fields of name,photo,video... maths) but here i am not creating the separate table for each table. tell... page then it automatically save into MySQL.but i am not create the table
Database
Database  Suppose i have created a table BOOKSHELF create table...); Therefore we can say now there are two indexes on the BOOKSHELF table one is implicitly... perform index scan or it perform full table scan? why?.....PLZ EXPLAIN IN DETAIL
Inserting Image in Database Table
Inserting Image in Database Table   ... to the MySQL database table.  Flow of the process : This program helps the user to insert an image in the MySQL database table. To insert
Retrieving the Image from a database Table
Retrieving the Image from a database Table Consider a case where we want... to retrieve the image from the database table. You can do it very easily after... from the database table our java program need to make a connection
database
database  in my database i add some fields.the total fields are first... syntax errors so send me the how to write the query and insert the one table values also.   Use the following query to create a table will all
Description of Database Table
Description of Database Table     ... about the database table. As we all know that, table has some specific information... by the database. By using a simple query we can get all information about the table
database
database  How can i get combo box values from database?? or how... of combo box in java - from database? you had given me the answer <%@page... from where can i download mysql?  my table name is office_name column
Arrange a Column of Database Table
Arrange a Column of Database Table   ... for arranging the data of database table in ascending order. Firstly we should know... : This query shows data of a column in ascending order of the specific database table
database
database  i am created one table in mysql database with one of the column name is emailid.now i want to write a java code that if the mail id... or not. If it is already exist in database, then show a message 'Already exists
Arrange a Column of Database Table
Arrange a Column of Database Table   ... that arrange the records of database table in descending order. The descending... with MySQL database. As soon as the connection gets established it takes a table
database
hired in 1981 from EMP table. Update the salary of all the employees to Rs. 10,000
how to import excel sheet into mysql database and save it as a table in database
how to import excel sheet into mysql database and save it as a table in database  sir, i want to import an excel sheet into a MySQL database and after importing it i want to store the excel sheet as a table in database
WANNA IMPORT RAINBOW TABLE IN MYSQL DATABASE
to import rainbow table in mysql database thanks...WANNA IMPORT RAINBOW TABLE IN MYSQL DATABASE  hello, i have a website and i have rainbow table uploaded on my server. this is multipart rainbow
Deleting a Table from Database
Deleting a Table from Database   ... database. But how we can delete the table using java methods and API. In this section we are describing, how to delete a table from database using java methods

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.