update

Ads
 

update

Predict and justify the output of the following code snippet written by the developer
to update the Status table:

String str = "UPDATE m_id SET m_id= ? WHERE bk_id= ? ";
PreparedStatement ps = con.prepareStatement(str);
ps.setString(1, "m2");
ps.setString(2, "bk23");
int rt=ps.executeUpdate();

View Answers

April 18, 2011 at 11:57 AM

import java.sql.*;
class UpdateData{
    public static void main(String[] args){
        try{
           Class.forName("com.mysql.jdbc.Driver");
           Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/roseindia", "root", "root");
           String str = "UPDATE Status SET name= ?,value=? WHERE id= 1 ";
           PreparedStatement ps = con.prepareStatement(str); 
           ps.setString(1, "m2"); 
           ps.setString(2, "bk23"); 
           ps.executeUpdate();
        }
        catch(Exception e){
           System.out.println(e);
        }
    }
}

For the above code, we have created following table:

CREATE TABLE `status` (                                  
          `id` bigint(255) NOT NULL auto_increment,              
          `name` varchar(255) default NULL,                      
          `value` varchar(255) default NULL,                     
          PRIMARY KEY  (`id`)                                    
        );

Ads









Related Tutorials/Questions & Answers:
update
update  how can i update multiple records in database using jsp ,servlet and jdbc based on selection of checkbox in jsp
update
update  Predict and justify the output of the following code snippet written by the developer to update the Status table: String str = "UPDATE m...://localhost:3306/roseindia", "root", "root"); String str = "UPDATE Status SET
Advertisements
update profile
update profile  coding for update profile
how to update
how to update   conditional update
update image
update image  sir, I want to do update image into database
to update the information
to update the information   sir, i am working on library mgt project. front end is core java and backend is ms access.i want to open,update the information through form.please send me code earliar
update database
update database  hi.. i want to know how the valuesof database can be updated in the jsf-jpa framework when the drop down button is clicked the data... that can be done there then by pressing the update buutton the value can be updated
Update value
Update value  How to update value of database using hibernate ?   Hi Samar, With the help of this code, you will see how can update database using hibernate. package net.roseindia.DAO; import
coding for update profile
coding for update profile  coding for update profile
update mysql database
update mysql database  update mysql database
update php cpanel
update php cpanel  update php cpanel
to update the information
update the information   sir, i am working on library mgt project. front end is core java and backend is ms access.i want to open,update the information through form.please send me code earliar.   Please visit
update jsp
update jsp  <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <!DOCTYPE html PUBLIC...;/Controller"> <center> <input type="hidden" name="page" value="update"/>
auto update codings
auto update codings  auto update coding in xml
how to update image in php
how to update image in php  how to update image in php
Update not working in hibernate.
Update not working in hibernate.  Update not working in hibernate
data update
edit/update data and saved them into that table again
Hibernate Update
In this section we will discuss various method of update
update statement in mysql
update statement in mysql  i am looking for mysql update statement example. Thanks
Update Profile
Update Profile       Update Profile This facility is used for updating user... user wishes to change their information, he may proceed by clicking on Update
ModuleNotFoundError: No module named 'update'
ModuleNotFoundError: No module named 'update'  Hi, My Python... 'update' How to remove the ModuleNotFoundError: No module named 'update'... to install padas library. You can install update python with following command
Update SQL Query Example
Update SQL Query Example  Hi, I am beginner in SQL (MySQL) and trying to learn Update SQL Query with Example code. Can anyone explain me the SQL Update query with an example code? Thanks   Hi, A simple example
Where to update the Hibernate tools?
Where to update the Hibernate tools?  Hi, What is the url to to update the hibernate tool in eclipse? Thanks   Hi, Hi if you are using the hibernate tool you can update it. Check Check the tutorial Hibernate tools
session update in php
session update in php  How to session update in php?   $this->session->set_userdata('name', $fullname
How to update table in Hibernate
How to update table in Hibernate  Hi, I have a table in database that has two fields in it. Student Name and ID, can anyone explain me how to update these tables in Hibernate. Thanks.   Update table query in Hibernate
Foreign key update table
Foreign key update table  How to update table that has the foreign key in SQL..?   ALTER TABLE YourTable ADD CONSTRAINT FK_YourForeignKey... (YourPrimaryKeyColumn) ON UPDATE CASCADE
how to update the value of jslider
how to update the value of jslider  hello, I want to make a audio player but the jslider is not updating help me
how to update the value of jslider
how to update the value of jslider  hello, I want to make a audio player but the jslider is not updating help me
how to update the value of jslider
how to update the value of jslider  hello, I want to make a audio player but the jslider is not updating help me
how to update the value of jslider
how to update the value of jslider  hello, I want to make a audio player but the jslider is not updating help me
how to update the value of jslider
how to update the value of jslider  hello, I want to make a audio player but the jslider is not updating help me

Ads