Monday, February 26, 2018

Java program : Embedding SQL in java

import java.util.*;
class SqlSyntax_1
{
    public static void main(String[] args)
    {
            Scanner scanner=new Scanner(System.in);
            System.out.println("enter id");
            int id=scanner.nextInt();
            System.out.println("enter name");
            String name=scanner.next();
            System.out.println("enter salary");
            float salary=scanner.nextFloat();
            String q2="insert into "+name+" values("+id+" ,'"+name+"',"+ salary+")";
            System.out.println(q2);
    }
}

Thanks
Happy programming!

No comments:

Post a Comment

How can I run a C++ program directly from Windows?

How-can-I-run-a-C-program-directly-from-Windows