Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
24 views

Write A Program To Update Row of Student Table From MSBTE Database Using My SQL Database Server

ajp practical 17
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views

Write A Program To Update Row of Student Table From MSBTE Database Using My SQL Database Server

ajp practical 17
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Write a program to update row of student table from MSBTE database using my sql

database server
package msbte;

import java.sql.*;

public class MSBTE {


public static void main(String[] args) {
try {
Connection con =
DriverManager.getConnection("jdbc:ucanaccess://D://MSBTE.accdb");
Statement s = con.createStatement();
s.execute("update msbte set P_id='P1237' where price=1000");
s.execute("select * from msbte");
ResultSet rs = s.getResultSet();
if (rs != null) {
while (rs.next()) {
System.out.println(" ");
System.out.println("Id of the product: " + rs.getString(1));
System.out.println("Price of product: " + rs.getString(2));
System.out.println(" ");
}
s.close();
con.close();
}
} catch (Exception err) {
System.out.println("ERROR: " + err);
}
}
}

You might also like