We are here with you hands in hands to facilitate your learning & don't appreciate the idea of copying or replicating solutions. Read More>>

Looking For Something at vustudents.ning.com? Click Here to Search

www.bit.ly/vucodes

+ Link For Assignments, GDBs & Online Quizzes Solution

www.bit.ly/papersvu

+ Link For Past Papers, Solved MCQs, Short Notes & More


Dear Students! Share your Assignments / GDBs / Quizzes files as you receive in your LMS, So it can be discussed/solved timely. Add Discussion

How to Add New Discussion in Study Group ? Step By Step Guide Click Here.

Please Read All Instructions Carefully First.

1. Changes:

  • Change the name of database file (BC00000.accdb) according to Your VU ID.
  • Open the Student.java and find and replace BC000000 with your VU ID.
  • Find this Code, Change the path of your database file. and change the name of DB file

        Connection con =  DriverManager.getConnection("jdbc:ucanaccess://F:/CS506/BC0000000.accdb");

2. Run:      

  • To run this just extract the solution files in drive E:,D:,F: etc not on Desktop.
  • open this folder and open cmd promote here.
  • In cmd pro first compile the all java files using javac Student.java
  • After compile run java Student class using java -cp F:\CS506\*;. Student
  • Also see the Video that given in Assignment

    

Good Luck



+ How to Follow the New Added Discussions at Your Mail Address?

+ How to Join Subject Study Groups & Get Helping Material?

+ How to become Top Reputation, Angels, Intellectual, Featured Members & Moderators?

+ VU Students Reserves The Right to Delete Your Profile, If?


See Your Saved Posts Timeline

Views: 13498

.

+ http://bit.ly/vucodes (Link for Assignments, GDBs & Online Quizzes Solution)

+ http://bit.ly/papersvu (Link for Past Papers, Solved MCQs, Short Notes & More)

+ Click Here to Search (Looking For something at vustudents.ning.com?)

+ Click Here To Join (Our facebook study Group)

Attachments:

Replies to This Discussion

yr mera to koi solution nikalo

mera ye error aa raha

Attachments:

janb

please reply

reply

g ??

dear ye error aa raha
what i do

@Ayaz koi Swing component hai jis ko ap ne initialize nhi kiya... 

Exp: JTextField jTextField = new JTextField(""); 

kindly give me some solution please

could not find or load main class framewndow error is coming 

@tahirmirani Code dakh k e pata chaly ga ab

ye code hai kindly help me plz

import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.sql.*;


 class FrameWindow implements ActionListener {

     private JFrame frame;

     JLabel newRecord1, idLabelSec1, nameLabelSec1, addLabelSec1, proLabelSec1;
     JTextField idTextField1, nameTextField1, addTextField1, proTextField1;
     JButton addRecordButton1;

     JPanel row2Panel, row3Panel;

     JLabel searchRecordLabel2, idSearchLabel2, idLabel2, naLabel2, addLabel2, proLabel2;
     JTextField idSer2, idDisplay2, nameDisplay2, addDisplay2, proDisplay2;

     JButton searchButton;


     private void initilize() {
         frame = new JFrame("Assignment 2");
         Container c = frame.getContentPane();
         c.setLayout(new GridLayout(10, 1, 12, 12));

         newRecord1 = new JLabel("Add New Record In Database");
         idLabelSec1 = new JLabel("Enter ID           ");
         nameLabelSec1 = new JLabel("Enter Name:   ");
         addLabelSec1 = new JLabel("Enter Address");
         proLabelSec1 = new JLabel("Program:");

         idTextField1 = new JTextField(15);
         nameTextField1 = new JTextField(15);
         addTextField1 = new JTextField(15);
         proTextField1 = new JTextField(15);


         c.add(newRecord1);

         row2Panel = new JPanel(new FlowLayout(FlowLayout.LEFT));
         row2Panel.add(idLabelSec1);
         row2Panel.add(idTextField1);
         row2Panel.add(nameLabelSec1);
         row2Panel.add(nameTextField1);

         c.add(row2Panel);

         row3Panel = new JPanel(new FlowLayout(FlowLayout.LEFT));
         row3Panel.add(addLabelSec1);
         row3Panel.add(addTextField1);
         row3Panel.add(proLabelSec1);
         row3Panel.add(proTextField1);

         c.add(row3Panel);


         addRecordButton1 = new JButton("Add Record In Database");
         c.add(addRecordButton1);

         searchRecordLabel2 = new JLabel("Search Record From Database");
         idSearchLabel2 = new JLabel("Enter ID");
         idLabel2 = new JLabel("ID");
         naLabel2 = new JLabel("Name");
         addLabel2 = new JLabel("Address");
         proLabel2 = new JLabel("Program");

         idSer2 = new JTextField(8);
         idDisplay2 = new JTextField(15);
         idDisplay2.setEditable(false);
         nameDisplay2 = new JTextField(15);
         nameDisplay2.setEditable(false);
         addDisplay2 = new JTextField(15);
         addDisplay2.setEditable(false);
         proDisplay2 = new JTextField(15);
         proDisplay2.setEditable(false);

         searchButton = new JButton("Search Record From Database");

         c.add(searchRecordLabel2);

         JPanel row6Panel = new JPanel(new FlowLayout(FlowLayout.LEFT));
         row6Panel.add(idSearchLabel2);
         row6Panel.add(idSer2);
         row6Panel.add(searchButton);

         c.add(row6Panel);

         JPanel row7Panel = new JPanel(new FlowLayout(FlowLayout.LEFT));
         row7Panel.add(idLabel2);
         row7Panel.add(idDisplay2);

         c.add(row7Panel);

         JPanel row8Panel, row9Panel, row10Panel;

         row8Panel = new JPanel(new FlowLayout(FlowLayout.LEFT));
         row8Panel.add(naLabel2);
         row8Panel.add(nameDisplay2);
         c.add(row8Panel);

         row9Panel = new JPanel(new FlowLayout(FlowLayout.LEFT));
         row9Panel.add(addLabel2);
         row9Panel.add(addDisplay2);
         c.add(row9Panel);

         row10Panel = new JPanel(new FlowLayout(FlowLayout.LEFT));

         row10Panel.add(proLabel2);
         row10Panel.add(proDisplay2);
         c.add(row10Panel);

         addRecordButton1.addActionListener(this);
         searchButton.addActionListener(this);


         frame.setDefaultCloseOperation(frame.EXIT_ON_CLOSE);
         frame.setVisible(true);
         frame.setSize(600, 600);
     }

     public void dataBase() {
         try {
             Class.forName("net.ucanaccess.jdbc.UcanaccessDriver");

             Connection con = DriverManager.getConnection("jdbc:ucanaccess://G:/CS506/src/MC150400392.accdb");

             String sql = "SELECT * FROM Student";

             PreparedStatement pst = con.prepareStatement(sql, ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE);

             ResultSet rs = pst.executeQuery();
             rs.moveToInsertRow();

             rs.updateString("ID", idTextField1.getText());
             rs.updateString("Name", nameTextField1.getText());
             rs.updateString("Address", addTextField1.getText());
             rs.updateString("Program", proTextField1.getText());

             rs.insertRow();

         } catch (SQLException e) {
             System.out.println(e);
         } catch (ClassNotFoundException ex) {
             System.out.println(ex);
         }
     }

     public void searchDb(String id) {
         try {
             Class.forName("net.Ucanaccess.jdbc.UcanaccessDriver");

             Connection con = DriverManager.getConnection("jdbc:ucanaccess:/G:/CS506/src/MC150400392.accdb");

             Statement st = con.createStatement();
             String sql = "SELECT * FROM Student";

             ResultSet rs = st.executeQuery(sql);
             int count = 0;

             while (rs.next()) ;
             {
                 String gettedID = rs.getString("ID");

                 if (id.equalsIgnoreCase(gettedID)) {
                     idDisplay2.setText(rs.getString("ID"));
                     nameDisplay2.setText(rs.getString("Name"));
                     addDisplay2.setText(rs.getString("Address"));
                     proDisplay2.setText(rs.getString("Program"));
                     count = 1;
                 }
             }
             if (count == 0) ;
             {
                 System.out.println("No Record Found");
             }


         } catch (SQLException e) {

             System.out.println(e);
         } catch (ClassNotFoundException ex) {
             System.out.println(ex);
         }
     }

     @Override
     public void actionPerformed(ActionEvent e) {
         if (e.getSource()==addRecordButton1)
         {
             dataBase();
         }
         if (e.getSource()==searchButton)
         {
             searchDb(idSer2.getText());
         }

     {
            if (e.getSource()==addRecordButton1)
            {
                dataBase();
            }
            if (e.getSource()==searchButton)
            {
                searchDb(idSer2.getText());
            }

        }

    }

    private FrameWindow()
    {
        initilize();
    }

    public static void main (String []args){
        FrameWindow fw=new FrameWindow();
    }

}

RSS

© 2020   Created by + M.Tariq Malik.   Powered by

Promote Us  |  Report an Issue  |  Privacy Policy  |  Terms of Service

.