Showing posts with label create. Show all posts
Showing posts with label create. Show all posts

Sunday, 21 October 2012

deleting a row/data from a table in JAVA




import java.sql.*;
import java.util.*;
class delete
{
    public static void main(String[] argv)
    {
        try
        {
            Scanner sc=new Scanner(System.in);
            String roll;
         
         
            Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
            String database="jdbc:odbc:eceDSN";
            Connection con=DriverManager.getConnection(database,"","");
            System.out.println("DATABASE OF ECE is Connected");
            System.out.println("Enter The Roll No");

            roll=sc.nextLine();
            PreparedStatement ps=con.prepareStatement("delete from ECE where roll=?");
            ps.setString(1,roll);
         
            //create a statement object
            //Statement st=con.createStatement();
            //Execute the statement
            int result=ps.executeUpdate();
            if(result==1)
            {
                System.out.println("Record is Deleted Successfully");
            }
            con.close();
        }
        catch(Exception err)
        {
            System.out.println(err.getMessage());
        }
    //loading all the driver to the memory

    }
}

updating a table's data in JAVA



import java.sql.*;
import java.util.*;
class update
{
    public static void main(String[] argv)
    {
        try
        {
            Scanner sc=new Scanner(System.in);
            int a, result, tot,phno;
            String dob, roll;
         
            Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");

creating of a table in JAVA



import java.sql.*;
import java.util.*;
class Student
{

    public  static void main(String[] argv)
    {
        try
        {
            Scanner sc=new Scanner(System.in);
            String roll,name,dob;
             int tot,phno;

Wednesday, 5 September 2012

create folders or files without name




This trick will show you hoe to make a nameless folder of file. So, keep reading....

STEP 1: First create a new folder.

STEP 2: Right click on it and select RENAME or press F2.


Tech N Science © 2013