Invalid String or buffer length ERROR

5 pts.
Tags:
JDBCODBC
SQL Server 2005
SQL Server 2005 Express
SQL Server error messages
I am trying to connect to SQL server 2005 express edition using JDBCODBC bridge driver. I have succesfuly configured the data source but when I use DriverManager.getConnection("jdbc:odbc:sql")-->sql is the data source name.. I catch this Exception.. Many thanks in advance

Answer Wiki

Thanks. We'll let you know when a new response is added.

Have you already done this ? :

<pre>Class.forName( “sun.jdbc.odbc.JdbcOdbcDriver” ); </pre>

Also, have you tried:

<pre>DriverManager.getConnection(“jdbc:odbc:sql”,”user”,”password”);</pre>

On the other hand, you could use the <a href=”http://msdn.microsoft.com/en-us/data/aa937724.aspx”>Microsoft SQL Server JDBC Driver</a> to avoid the use of the bridge.

Discuss This Question: 3  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • DoN007
    I have same problem, error is "[Microsoft][ODBC Driver Manager] Invalid string or buffer length" My code is: Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); con=DriverManager.getConnection("jdbc:odbc:emp_record","hr","hr"); } catch(Exception e) { jLabel3.setText("Connection=" +con); System.out.println(e); jLabel2.setText("Exception="+e); I am unable to connect to database. Please provide assistance in this issue. Thanks in advance
    10 pointsBadges:
    report
  • StudentRegistration
    “[Microsoft][ODBC Driver Manager] Invalid string or buffer length”- i have the same error my code is: package registration; import java.sql.*; import javax.swing.JOptionPane; public class connection { Connection con=null; Statement stmt = null; ResultSet rs = null; boolean flag=false; String driver="sun.jdbc.odbc.JdbcOdbcDriver"; String dsn="jdbc:odbc:ashy"; String username="sa"; String password="sql2005"; public boolean sqlConnect() { flag = false; try { Class.forName(driver); con = DriverManager.getConnection(dsn, username, password); stmt = con.createStatement(); flag = true; }catch(Exception ex) { flag=false; JOptionPane.showMessageDialog(null, ex.getMessage().toString()); } return flag; } public ResultSet execQuery(String sql) { try { rs = stmt.executeQuery(sql); }catch(Exception ex) { rs = null; JOptionPane.showMessageDialog(null, ex.getMessage().toString()); } return rs; } public boolean execUpdate(String sql) { flag = false; try { stmt.executeUpdate(sql); flag=true; }catch(Exception ex) { flag = false; JOptionPane.showMessageDialog(null, ex.getMessage().toString()); } return flag; } } that is for my connection this is for my gui forms: package registration; import java.sql.ResultSet; import java.sql.Statement; import javax.swing.JOptionPane; public class Registration extends javax.swing.JFrame { connection cn= new connection(); String fullname,username,password,regDate,confirm,courseid,coursename,duration,tutionfee,batchid,batchname,starttime,endtime,facultyid,facultyname,gender,contact,address,studentid,firstname,lastname,Gender,Contact,father,mother,parentcontact; boolean flag; private Statement stmt; private ResultSet rs; public Registration() { initComponents(); } @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code"> private void initComponents() { MainTab = new javax.swing.JTabbedPane(); UserTab = new javax.swing.JTabbedPane(); jPanel1 = new javax.swing.JPanel(); btnClear = new javax.swing.JButton(); jLabel1 = new javax.swing.JLabel(); txtPwd = new javax.swing.JPasswordField(); txtConfirmPwd = new javax.swing.JPasswordField(); txtFullName = new javax.swing.JTextField(); lblFullName = new javax.swing.JLabel(); btnAdd = new javax.swing.JButton(); lblConfirmPwd = new javax.swing.JLabel(); lblPwd = new javax.swing.JLabel(); txtUsername = new javax.swing.JTextField(); lblUsername = new javax.swing.JLabel(); txtRegDate = new javax.swing.JTextField(); lblRegDate = new javax.swing.JLabel(); btnSearch = new javax.swing.JButton(); btnUpdate = new javax.swing.JButton(); FacultyPane = new javax.swing.JPanel(); lblFacultyID = new javax.swing.JLabel(); txtFacultyID = new javax.swing.JTextField(); lblFacultyName = new javax.swing.JLabel(); txtFacultyName = new javax.swing.JTextField(); lblgender = new javax.swing.JLabel(); txtGender = new javax.swing.JTextField(); jLabel3 = new javax.swing.JLabel(); txtContact = new javax.swing.JTextField(); lblAddress = new javax.swing.JLabel(); txtAddress = new javax.swing.JTextField(); btnFEnter = new javax.swing.JButton(); btnFUpdate = new javax.swing.JButton(); btnFClear = new javax.swing.JButton(); CoursePane = new javax.swing.JPanel(); lblCourseID = new javax.swing.JLabel(); txtCourseID = new javax.swing.JTextField(); lblCourseName = new javax.swing.JLabel(); txtCourseName = new javax.swing.JTextField(); lblDuration = new javax.swing.JLabel(); txtDuration = new javax.swing.JTextField(); lblTutionFee = new javax.swing.JLabel(); txtTutionFee = new javax.swing.JTextField(); btnEnter = new javax.swing.JButton(); btnCUpdate = new javax.swing.JButton(); btnCclear = new javax.swing.JButton(); BatchesPane = new javax.swing.JPanel(); lblModuleID = new javax.swing.JLabel(); txtBatchID = new javax.swing.JTextField(); lblBatchName = new javax.swing.JLabel(); txtBatchName = new javax.swing.JTextField(); lblStartTime = new javax.swing.JLabel(); lblEndTime = new javax.swing.JLabel(); txtStartTime = new javax.swing.JTextField(); txtEndTime = new javax.swing.JTextField(); btnBEnter = new javax.swing.JButton(); btnBUpdate = new javax.swing.JButton(); btnBClear = new javax.swing.JButton(); jPanel2 = new javax.swing.JPanel(); jLabel5 = new javax.swing.JLabel(); txtStudentID = new javax.swing.JTextField(); lblFirstName = new javax.swing.JLabel(); txtFirstName = new javax.swing.JTextField(); lblLastName = new javax.swing.JLabel(); txtLastName = new javax.swing.JTextField(); lblGender = new javax.swing.JLabel(); txtgender = new javax.swing.JTextField(); lblContact = new javax.swing.JLabel(); txtcontact = new javax.swing.JTextField(); lblFatherName = new javax.swing.JLabel(); txtFatherName = new javax.swing.JTextField(); lblMotherName = new javax.swing.JLabel(); txtMotherName = new javax.swing.JTextField(); lblParentContact = new javax.swing.JLabel(); txtParentContact = new javax.swing.JTextField(); btnSEnter = new javax.swing.JButton(); btnSUpdate = new javax.swing.JButton(); btnSClear = new javax.swing.JButton(); jPanel3 = new javax.swing.JPanel(); lblstudentid = new javax.swing.JLabel(); txtstudentid = new javax.swing.JTextField(); btnSISearch = new javax.swing.JButton(); lblstudentname = new javax.swing.JLabel(); txtstudentname = new javax.swing.JTextField(); btnSSearch = new javax.swing.JButton(); LBLCOURSEID = new javax.swing.JLabel(); TXTCOURSEID = new javax.swing.JTextField(); LBLFACULTYID = new javax.swing.JLabel(); TXTFACULTYID = new javax.swing.JTextField(); LBLBATCHID = new javax.swing.JLabel(); TXTBATCHID = new javax.swing.JTextField(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); addWindowListener(new java.awt.event.WindowAdapter() { public void windowOpened(java.awt.event.WindowEvent evt) { formWindowOpened(evt); } }); UserTab.setName(""); // NOI18N jPanel1.setBackground(new java.awt.Color(153, 255, 153)); btnClear.setFont(new java.awt.Font("Tahoma", 0, 14)); btnClear.setText("Clear"); btnClear.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnClearActionPerformed(evt); } }); jLabel1.setFont(new java.awt.Font("Tahoma", 0, 24)); jLabel1.setText("Manage Users"); txtPwd.setFont(new java.awt.Font("Tahoma", 0, 14)); txtConfirmPwd.setFont(new java.awt.Font("Tahoma", 0, 14)); txtFullName.setFont(new java.awt.Font("Tahoma", 0, 14)); lblFullName.setFont(new java.awt.Font("Tahoma", 0, 14)); lblFullName.setText("Full Name :"); btnAdd.setFont(new java.awt.Font("Tahoma", 0, 14)); btnAdd.setText("Add User"); btnAdd.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnAddActionPerformed(evt); } }); lblConfirmPwd.setFont(new java.awt.Font("Tahoma", 0, 14)); lblConfirmPwd.setText("Confirm :"); lblPwd.setFont(new java.awt.Font("Tahoma", 0, 14)); lblPwd.setText("Password :"); txtUsername.setFont(new java.awt.Font("Tahoma", 0, 14)); lblUsername.setFont(new java.awt.Font("Tahoma", 0, 14)); lblUsername.setText("UserName :"); txtRegDate.setFont(new java.awt.Font("Tahoma", 0, 14)); lblRegDate.setFont(new java.awt.Font("Tahoma", 0, 14)); lblRegDate.setText("Reg Date :"); btnSearch.setFont(new java.awt.Font("Tahoma", 0, 14)); btnSearch.setText("Search"); btnSearch.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnSearchActionPerformed(evt); } }); btnUpdate.setFont(new java.awt.Font("Tahoma", 0, 14)); btnUpdate.setText("Update User"); btnUpdate.setEnabled(false); btnUpdate.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnUpdateActionPerformed(evt); } }); javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addGap(242, 242, 242) .addComponent(jLabel1)) .addGroup(jPanel1Layout.createSequentialGroup() .addGap(29, 29, 29) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(lblUsername) .addComponent(lblFullName) .addComponent(lblPwd) .addComponent(lblConfirmPwd) .addComponent(lblRegDate)) .addGap(35, 35, 35) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(txtRegDate) .addComponent(txtConfirmPwd) .addComponent(txtPwd) .addComponent(txtUsername) .addComponent(txtFullName, javax.swing.GroupLayout.DEFAULT_SIZE, 239, Short.MAX_VALUE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(btnSearch, javax.swing.GroupLayout.PREFERRED_SIZE, 93, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(jPanel1Layout.createSequentialGroup() .addContainerGap() .addComponent(btnAdd, javax.swing.GroupLayout.PREFERRED_SIZE, 119, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addComponent(btnUpdate, javax.swing.GroupLayout.PREFERRED_SIZE, 119, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addComponent(btnClear))) .addContainerGap(43, Short.MAX_VALUE)) ); jPanel1Layout.setVerticalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addContainerGap() .addComponent(jLabel1) .addGap(18, 18, 18) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(txtFullName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(lblFullName) .addComponent(btnSearch)) .addGap(18, 18, 18) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(lblUsername) .addComponent(txtUsername, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(18, 18, 18) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(lblPwd) .addComponent(txtPwd, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(18, 18, 18) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(lblConfirmPwd) .addComponent(txtConfirmPwd, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(18, 18, 18) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(lblRegDate) .addComponent(txtRegDate, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(18, 18, 18) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(btnAdd) .addComponent(btnUpdate) .addComponent(btnClear)) .addContainerGap(147, Short.MAX_VALUE)) ); UserTab.addTab("MANAGE USERS", jPanel1); MainTab.addTab("USERS", UserTab); FacultyPane.setBackground(new java.awt.Color(153, 255, 153)); lblFacultyID.setText("FACULTY ID:"); lblFacultyName.setText("FACULTY NAME:"); lblgender.setText("GENDER:"); jLabel3.setText("CONTACT:"); lblAddress.setText("ADDRESS:"); btnFEnter.setText("Enter"); btnFEnter.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnFEnterActionPerformed(evt); } }); btnFUpdate.setText("Update"); btnFUpdate.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnFUpdateActionPerformed(evt); } }); btnFClear.setText("Clear"); btnFClear.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnFClearActionPerformed(evt); } }); javax.swing.GroupLayout FacultyPaneLayout = new javax.swing.GroupLayout(FacultyPane); FacultyPane.setLayout(FacultyPaneLayout); FacultyPaneLayout.setHorizontalGroup( FacultyPaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(FacultyPaneLayout.createSequentialGroup() .addContainerGap() .addGroup(FacultyPaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(FacultyPaneLayout.createSequentialGroup() .addComponent(lblgender, javax.swing.GroupLayout.DEFAULT_SIZE, 68, Short.MAX_VALUE) .addGap(443, 443, 443)) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, FacultyPaneLayout.createSequentialGroup() .addGroup(FacultyPaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(FacultyPaneLayout.createSequentialGroup() .addGroup(FacultyPaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(lblFacultyName, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(lblFacultyID, javax.swing.GroupLayout.DEFAULT_SIZE, 79, Short.MAX_VALUE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, FacultyPaneLayout.createSequentialGroup() .addGroup(FacultyPaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(lblAddress, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 75, Short.MAX_VALUE) .addComponent(jLabel3, javax.swing.GroupLayout.DEFAULT_SIZE, 75, Short.MAX_VALUE)) .addGap(8, 8, 8))) .addGroup(FacultyPaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(txtContact, javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(txtFacultyID, javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(txtGender) .addComponent(txtFacultyName, javax.swing.GroupLayout.DEFAULT_SIZE, 98, Short.MAX_VALUE) .addComponent(txtAddress, javax.swing.GroupLayout.PREFERRED_SIZE, 137, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(291, 291, 291)) .addGroup(FacultyPaneLayout.createSequentialGroup() .addComponent(btnFEnter) .addGap(18, 18, 18) .addComponent(btnFUpdate) .addGap(18, 18, 18) .addComponent(btnFClear) .addContainerGap(292, Short.MAX_VALUE)))) ); FacultyPaneLayout.setVerticalGroup( FacultyPaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(FacultyPaneLayout.createSequentialGroup() .addGap(42, 42, 42) .addGroup(FacultyPaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(lblFacultyID) .addComponent(txtFacultyID, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(18, 18, 18) .addGroup(FacultyPaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(lblFacultyName) .addComponent(txtFacultyName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(18, 18, 18) .addGroup(FacultyPaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(lblgender) .addComponent(txtGender, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(18, 18, 18) .addGroup(FacultyPaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel3) .addComponent(txtContact, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(18, 18, 18) .addGroup(FacultyPaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(lblAddress) .addComponent(txtAddress, javax.swing.GroupLayout.PREFERRED_SIZE, 61, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(39, 39, 39) .addGroup(FacultyPaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(btnFEnter) .addComponent(btnFUpdate) .addComponent(btnFClear)) .addContainerGap(148, Short.MAX_VALUE)) ); MainTab.addTab("FACULTY", FacultyPane); CoursePane.setBackground(new java.awt.Color(153, 255, 153)); lblCourseID.setText("COURSE ID"); lblCourseName.setText("COURSE NAME"); lblDuration.setText("DURATION"); lblTutionFee.setText("TUITIION FEE"); btnEnter.setText("Enter"); btnEnter.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnEnterActionPerformed(evt); } }); btnCUpdate.setText("Update"); btnCUpdate.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnCUpdateActionPerformed(evt); } }); btnCclear.setText("Clear"); btnCclear.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnCclearActionPerformed(evt); } }); javax.swing.GroupLayout CoursePaneLayout = new javax.swing.GroupLayout(CoursePane); CoursePane.setLayout(CoursePaneLayout); CoursePaneLayout.setHorizontalGroup( CoursePaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(CoursePaneLayout.createSequentialGroup() .addContainerGap() .addGroup(CoursePaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(CoursePaneLayout.createSequentialGroup() .addComponent(btnEnter) .addGap(35, 35, 35) .addComponent(btnCUpdate) .addGap(30, 30, 30) .addComponent(btnCclear)) .addGroup(CoursePaneLayout.createSequentialGroup() .addGroup(CoursePaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(lblCourseID) .addComponent(lblCourseName, javax.swing.GroupLayout.PREFERRED_SIZE, 88, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(lblDuration, javax.swing.GroupLayout.PREFERRED_SIZE, 67, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(lblTutionFee)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(CoursePaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(txtTutionFee, javax.swing.GroupLayout.DEFAULT_SIZE, 165, Short.MAX_VALUE) .addComponent(txtDuration, javax.swing.GroupLayout.DEFAULT_SIZE, 165, Short.MAX_VALUE) .addComponent(txtCourseID, javax.swing.GroupLayout.DEFAULT_SIZE, 165, Short.MAX_VALUE) .addComponent(txtCourseName, javax.swing.GroupLayout.DEFAULT_SIZE, 165, Short.MAX_VALUE)))) .addContainerGap(254, javax.swing.GroupLayout.PREFERRED_SIZE)) ); CoursePaneLayout.setVerticalGroup( CoursePaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(CoursePaneLayout.createSequentialGroup() .addGap(44, 44, 44) .addGroup(CoursePaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(lblCourseID) .addComponent(txtCourseID, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(18, 18, 18) .addGroup(CoursePaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(lblCourseName, javax.swing.GroupLayout.PREFERRED_SIZE, 17, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(txtCourseName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(18, 18, 18) .addGroup(CoursePaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(lblDuration) .addComponent(txtDuration, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(18, 18, 18) .addGroup(CoursePaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(lblTutionFee) .addComponent(txtTutionFee, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(42, 42, 42) .addGroup(CoursePaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(btnEnter) .addComponent(btnCUpdate) .addComponent(btnCclear)) .addContainerGap(222, Short.MAX_VALUE)) ); MainTab.addTab("COURSES", CoursePane); BatchesPane.setBackground(new java.awt.Color(153, 255, 153)); lblModuleID.setText("BATCH ID:"); lblBatchName.setText("Batch Name:"); lblStartTime.setText("Start Time:"); lblEndTime.setText("End Time:"); btnBEnter.setText("Enter"); btnBEnter.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnBEnterActionPerformed(evt); } }); btnBUpdate.setText("Update"); btnBUpdate.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnBUpdateActionPerformed(evt); } }); btnBClear.setText("Clear"); btnBClear.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnBClearActionPerformed(evt); } }); javax.swing.GroupLayout BatchesPaneLayout = new javax.swing.GroupLayout(BatchesPane); BatchesPane.setLayout(BatchesPaneLayout); BatchesPaneLayout.setHorizontalGroup( BatchesPaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(BatchesPaneLayout.createSequentialGroup() .addContainerGap() .addGroup(BatchesPaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(BatchesPaneLayout.createSequentialGroup() .addGroup(BatchesPaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) .addComponent(lblEndTime, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(lblStartTime, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(lblBatchName, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(lblModuleID, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 66, Short.MAX_VALUE)) .addGap(18, 18, 18) .addGroup(BatchesPaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(txtEndTime) .addComponent(txtStartTime) .addComponent(txtBatchName) .addComponent(txtBatchID, javax.swing.GroupLayout.DEFAULT_SIZE, 84, Short.MAX_VALUE))) .addGroup(BatchesPaneLayout.createSequentialGroup() .addComponent(btnBEnter) .addGap(18, 18, 18) .addComponent(btnBUpdate) .addGap(18, 18, 18) .addComponent(btnBClear))) .addContainerGap(292, Short.MAX_VALUE)) ); BatchesPaneLayout.setVerticalGroup( BatchesPaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(BatchesPaneLayout.createSequentialGroup() .addGap(38, 38, 38) .addGroup(BatchesPaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(lblModuleID) .addComponent(txtBatchID, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(18, 18, 18) .addGroup(BatchesPaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(lblBatchName) .addComponent(txtBatchName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(18, 18, 18) .addGroup(BatchesPaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(lblStartTime) .addComponent(txtStartTime, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(18, 18, 18) .addGroup(BatchesPaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(lblEndTime) .addComponent(txtEndTime, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(18, 18, 18) .addGroup(BatchesPaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(btnBEnter) .addComponent(btnBUpdate) .addComponent(btnBClear)) .addContainerGap(252, Short.MAX_VALUE)) ); MainTab.addTab("BATCHES", BatchesPane); jPanel2.setBackground(new java.awt.Color(153, 255, 153)); jLabel5.setText("STUDENT ID:"); lblFirstName.setText("FIRST NAME"); txtFirstName.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { txtFirstNameActionPerformed(evt); } }); lblLastName.setText("LAST NAME"); lblGender.setText("GENDER"); lblContact.setText("CONTACT"); lblFatherName.setText("FATHER NAME"); lblMotherName.setText("MOTHER NAME"); lblParentContact.setText("PARENT'S CONTACT"); btnSEnter.setText("Enter"); btnSEnter.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnSEnterActionPerformed(evt); } }); btnSUpdate.setText("Update"); btnSUpdate.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnSUpdateActionPerformed(evt); } }); btnSClear.setText("Clear"); btnSClear.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnSClearActionPerformed(evt); } }); javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2); jPanel2.setLayout(jPanel2Layout); jPanel2Layout.setHorizontalGroup( jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createSequentialGroup() .addContainerGap() .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createSequentialGroup() .addComponent(lblContact) .addGap(54, 54, 54)) .addGroup(jPanel2Layout.createSequentialGroup() .addComponent(lblGender, javax.swing.GroupLayout.PREFERRED_SIZE, 57, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(45, 45, 45)) .addGroup(jPanel2Layout.createSequentialGroup() .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 76, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(lblFirstName, javax.swing.GroupLayout.PREFERRED_SIZE, 69, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(lblLastName, javax.swing.GroupLayout.PREFERRED_SIZE, 76, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 35, Short.MAX_VALUE)) .addGroup(jPanel2Layout.createSequentialGroup() .addComponent(lblFatherName, javax.swing.GroupLayout.DEFAULT_SIZE, 90, Short.MAX_VALUE) .addGap(21, 21, 21))) .addComponent(lblParentContact) .addComponent(lblMotherName)) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addGroup(jPanel2Layout.createSequentialGroup() .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(txtStudentID, javax.swing.GroupLayout.DEFAULT_SIZE, 123, Short.MAX_VALUE)) .addComponent(txtFirstName, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 123, Short.MAX_VALUE) .addGroup(jPanel2Layout.createSequentialGroup() .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(txtParentContact, javax.swing.GroupLayout.DEFAULT_SIZE, 123, Short.MAX_VALUE)) .addComponent(txtMotherName, javax.swing.GroupLayout.DEFAULT_SIZE, 123, Short.MAX_VALUE) .addComponent(txtFatherName, javax.swing.GroupLayout.DEFAULT_SIZE, 123, Short.MAX_VALUE) .addComponent(txtLastName, javax.swing.GroupLayout.DEFAULT_SIZE, 123, Short.MAX_VALUE) .addComponent(txtgender, javax.swing.GroupLayout.DEFAULT_SIZE, 123, Short.MAX_VALUE) .addComponent(txtcontact, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 123, Short.MAX_VALUE)) .addGap(277, 277, 277)) .addGroup(jPanel2Layout.createSequentialGroup() .addGap(18, 18, 18) .addComponent(btnSEnter) .addGap(18, 18, 18) .addComponent(btnSUpdate) .addGap(18, 18, 18) .addComponent(btnSClear) .addContainerGap(284, Short.MAX_VALUE)) ); jPanel2Layout.setVerticalGroup( jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createSequentialGroup() .addGap(27, 27, 27) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel5) .addComponent(txtStudentID, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(18, 18, 18) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(lblFirstName) .addComponent(txtFirstName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(18, 18, 18) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(lblLastName) .addComponent(txtLastName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(18, 18, 18) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(lblGender, javax.swing.GroupLayout.PREFERRED_SIZE, 21, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(txtgender, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(18, 18, 18) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(lblContact) .addComponent(txtcontact, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(18, 18, 18) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(lblFatherName, javax.swing.GroupLayout.PREFERRED_SIZE, 17, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(txtFatherName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(21, 21, 21) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(lblMotherName) .addComponent(txtMotherName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(18, 18, 18) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(lblParentContact) .addComponent(txtParentContact, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(18, 18, 18) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(btnSEnter) .addComponent(btnSUpdate) .addComponent(btnSClear)) .addContainerGap(107, Short.MAX_VALUE)) ); MainTab.addTab("STUDENT REGISTRATION", jPanel2); jPanel3.setBackground(new java.awt.Color(153, 255, 153)); lblstudentid.setText("STUDENT ID"); btnSISearch.setText("Search"); btnSISearch.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnSISearchActionPerformed(evt); } }); lblstudentname.setText("STUDENT NAME"); btnSSearch.setText("Search"); btnSSearch.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnSSearchActionPerformed(evt); } }); LBLCOURSEID.setText("COURSE ID:"); LBLFACULTYID.setText("FACULTY ID:"); LBLBATCHID.setText("BATCH ID:"); javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3); jPanel3.setLayout(jPanel3Layout); jPanel3Layout.setHorizontalGroup( jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel3Layout.createSequentialGroup() .addContainerGap() .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel3Layout.createSequentialGroup() .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(lblstudentname) .addComponent(lblstudentid)) .addGap(18, 18, 18)) .addGroup(jPanel3Layout.createSequentialGroup() .addComponent(LBLCOURSEID, javax.swing.GroupLayout.DEFAULT_SIZE, 66, Short.MAX_VALUE) .addGap(28, 28, 28)) .addGroup(jPanel3Layout.createSequentialGroup() .addComponent(LBLFACULTYID, javax.swing.GroupLayout.DEFAULT_SIZE, 66, Short.MAX_VALUE) .addGap(28, 28, 28)) .addGroup(jPanel3Layout.createSequentialGroup() .addComponent(LBLBATCHID, javax.swing.GroupLayout.DEFAULT_SIZE, 66, Short.MAX_VALUE) .addGap(28, 28, 28))) .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(TXTBATCHID) .addComponent(TXTFACULTYID) .addComponent(TXTCOURSEID) .addComponent(txtstudentname) .addComponent(txtstudentid, javax.swing.GroupLayout.DEFAULT_SIZE, 124, Short.MAX_VALUE)) .addGap(18, 18, 18) .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(btnSISearch) .addComponent(btnSSearch)) .addContainerGap(210, Short.MAX_VALUE)) ); jPanel3Layout.setVerticalGroup( jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel3Layout.createSequentialGroup() .addGap(23, 23, 23) .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(txtstudentid, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(btnSISearch) .addComponent(lblstudentid)) .addGap(18, 18, 18) .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(lblstudentname) .addComponent(txtstudentname, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(btnSSearch)) .addGap(50, 50, 50) .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(LBLCOURSEID) .addComponent(TXTCOURSEID, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(18, 18, 18) .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(LBLFACULTYID) .addComponent(TXTFACULTYID, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel3Layout.createSequentialGroup() .addGap(18, 18, 18) .addComponent(LBLBATCHID)) .addGroup(jPanel3Layout.createSequentialGroup() .addGap(26, 26, 26) .addComponent(TXTBATCHID, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))) .addContainerGap(224, Short.MAX_VALUE)) ); MainTab.addTab("SEARCH INFORMATION", jPanel3); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(MainTab, javax.swing.GroupLayout.PREFERRED_SIZE, 526, javax.swing.GroupLayout.PREFERRED_SIZE) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(MainTab, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 493, Short.MAX_VALUE) ); pack(); }// </editor-fold> private void btnClearActionPerformed(java.awt.event.ActionEvent evt) { if(evt.getSource()==btnClear) { clear(); } } private void btnAddActionPerformed(java.awt.event.ActionEvent evt) { if(evt.getSource()==btnAdd) { addUser(); btnUpdate.setEnabled(false); } } private void btnSearchActionPerformed(java.awt.event.ActionEvent evt) { if(evt.getSource()==btnSearch){ getRecords(); btnEnter.setEnabled(false); } } private void btnUpdateActionPerformed(java.awt.event.ActionEvent evt) { if(evt.getSource()==btnUpdate){ Update(); btnAdd.setEnabled(false); } } private void btnCclearActionPerformed(java.awt.event.ActionEvent evt) { if(evt.getSource()==btnCclear){ Cclear(); } } private void btnCUpdateActionPerformed(java.awt.event.ActionEvent evt) { if(evt.getSource()==btnCUpdate){ CUpdate(); btnEnter.setEnabled(false); } } private void btnEnterActionPerformed(java.awt.event.ActionEvent evt) { if(evt.getSource()==btnEnter){ addCourses(); btnCUpdate.setEnabled(false); } } private void btnBEnterActionPerformed(java.awt.event.ActionEvent evt) { if(evt.getSource()==btnBEnter){ addBatches(); btnBUpdate.setEnabled(false); } } private void btnBClearActionPerformed(java.awt.event.ActionEvent evt) { if(evt.getSource()==btnBClear){ Bclear(); } } private void btnBUpdateActionPerformed(java.awt.event.ActionEvent evt) { if(evt.getSource()==btnBUpdate){ Bupdate(); btnBEnter.setEnabled(false); } } private void btnFEnterActionPerformed(java.awt.event.ActionEvent evt) { if(evt.getSource()==btnFEnter){ addFaculty(); btnFUpdate.setEnabled(false); } } private void btnFClearActionPerformed(java.awt.event.ActionEvent evt) { if(evt.getSource()==btnFClear){ Fclear();} } private void btnFUpdateActionPerformed(java.awt.event.ActionEvent evt) { if(evt.getSource()==btnFUpdate){ FUpdate(); btnFEnter.setEnabled(false); } } private void txtFirstNameActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: } private void btnSEnterActionPerformed(java.awt.event.ActionEvent evt) { if(evt.getSource()==btnSEnter){ addStudentRegistration(); btnSUpdate.setEnabled(false); } } private void btnSClearActionPerformed(java.awt.event.ActionEvent evt) { if(evt.getSource()==btnSClear){ SRclear(); } } private void btnSUpdateActionPerformed(java.awt.event.ActionEvent evt) { if(evt.getSource()==btnSUpdate){ SUpdate(); btnSEnter.setEnabled(false); } } private void btnSISearchActionPerformed(java.awt.event.ActionEvent evt) { if(evt.getSource()==btnSISearch){ getResults(); } } private void formWindowOpened(java.awt.event.WindowEvent evt) { txtRegDate.setText(new java.util.Date().toString()); } private void btnSSearchActionPerformed(java.awt.event.ActionEvent evt) { if(evt.getSource()==btnSSearch){ getInformation(); } } /** * @param args the command line arguments */ public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */ try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(Registration.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(Registration.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(Registration.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(Registration.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } //</editor-fold> /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { @Override public void run() { new Registration().setVisible(true); } }); } // Variables declaration - do not modify private javax.swing.JPanel BatchesPane; private javax.swing.JPanel CoursePane; private javax.swing.JPanel FacultyPane; private javax.swing.JLabel LBLBATCHID; private javax.swing.JLabel LBLCOURSEID; private javax.swing.JLabel LBLFACULTYID; private javax.swing.JTabbedPane MainTab; private javax.swing.JTextField TXTBATCHID; private javax.swing.JTextField TXTCOURSEID; private javax.swing.JTextField TXTFACULTYID; private javax.swing.JTabbedPane UserTab; private javax.swing.JButton btnAdd; private javax.swing.JButton btnBClear; private javax.swing.JButton btnBEnter; private javax.swing.JButton btnBUpdate; private javax.swing.JButton btnCUpdate; private javax.swing.JButton btnCclear; private javax.swing.JButton btnClear; private javax.swing.JButton btnEnter; private javax.swing.JButton btnFClear; private javax.swing.JButton btnFEnter; private javax.swing.JButton btnFUpdate; private javax.swing.JButton btnSClear; private javax.swing.JButton btnSEnter; private javax.swing.JButton btnSISearch; private javax.swing.JButton btnSSearch; private javax.swing.JButton btnSUpdate; private javax.swing.JButton btnSearch; private javax.swing.JButton btnUpdate; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel3; private javax.swing.JLabel jLabel5; private javax.swing.JPanel jPanel1; private javax.swing.JPanel jPanel2; private javax.swing.JPanel jPanel3; private javax.swing.JLabel lblAddress; private javax.swing.JLabel lblBatchName; private javax.swing.JLabel lblConfirmPwd; private javax.swing.JLabel lblContact; private javax.swing.JLabel lblCourseID; private javax.swing.JLabel lblCourseName; private javax.swing.JLabel lblDuration; private javax.swing.JLabel lblEndTime; private javax.swing.JLabel lblFacultyID; private javax.swing.JLabel lblFacultyName; private javax.swing.JLabel lblFatherName; private javax.swing.JLabel lblFirstName; private javax.swing.JLabel lblFullName; private javax.swing.JLabel lblGender; private javax.swing.JLabel lblLastName; private javax.swing.JLabel lblModuleID; private javax.swing.JLabel lblMotherName; private javax.swing.JLabel lblParentContact; private javax.swing.JLabel lblPwd; private javax.swing.JLabel lblRegDate; private javax.swing.JLabel lblStartTime; private javax.swing.JLabel lblTutionFee; private javax.swing.JLabel lblUsername; private javax.swing.JLabel lblgender; private javax.swing.JLabel lblstudentid; private javax.swing.JLabel lblstudentname; private javax.swing.JTextField txtAddress; private javax.swing.JTextField txtBatchID; private javax.swing.JTextField txtBatchName; private javax.swing.JPasswordField txtConfirmPwd; private javax.swing.JTextField txtContact; private javax.swing.JTextField txtCourseID; private javax.swing.JTextField txtCourseName; private javax.swing.JTextField txtDuration; private javax.swing.JTextField txtEndTime; private javax.swing.JTextField txtFacultyID; private javax.swing.JTextField txtFacultyName; private javax.swing.JTextField txtFatherName; private javax.swing.JTextField txtFirstName; private javax.swing.JTextField txtFullName; private javax.swing.JTextField txtGender; private javax.swing.JTextField txtLastName; private javax.swing.JTextField txtMotherName; private javax.swing.JTextField txtParentContact; private javax.swing.JPasswordField txtPwd; private javax.swing.JTextField txtRegDate; private javax.swing.JTextField txtStartTime; private javax.swing.JTextField txtStudentID; private javax.swing.JTextField txtTutionFee; private javax.swing.JTextField txtUsername; private javax.swing.JTextField txtcontact; private javax.swing.JTextField txtgender; private javax.swing.JTextField txtstudentid; private javax.swing.JTextField txtstudentname; // End of variables declaration private void addUser() { if(validateForm()) { if(cn.sqlConnect()) { cn.execUpdate("insert into users values ('"+fullname+"','"+username+"','"+confirm+"','"+regDate+"')"); JOptionPane.showMessageDialog(null, "User added successfully."); clear(); } else { JOptionPane.showMessageDialog(null, "User NOT added."); clear(); } } } private boolean validateForm() { getFields(); flag = false; if(fullname.equals("") || username.equals("") || password.equals("") || regDate.equals("")) { flag = false; JOptionPane.showMessageDialog(null, "All fields are required."); txtFullName.requestFocus(); } else if(!password.equals(confirm)) { flag = false; JOptionPane.showMessageDialog(null, "Passwords do not match."); txtConfirmPwd.requestFocus(); } else { flag=true; } return flag; } private void getFields() { fullname = txtFullName.getText(); username = txtUsername.getText(); password = txtPwd.getText(); confirm = txtConfirmPwd.getText(); regDate = txtRegDate.getText(); } private void clear() { txtFullName.setText(""); txtUsername.setText(""); txtPwd.setText(""); txtConfirmPwd.setText(""); txtFullName.requestFocus(); } private void getRecords() { getFields(); if(fullname.equals("")) { JOptionPane.showMessageDialog(null, "Enter full name to search."); txtFullName.requestFocus(); } else { if(cn.sqlConnect()) { try { btnAdd.setEnabled(false); btnUpdate.setEnabled(true); cn.execQuery("select * from users where fullname like '%"+fullname+"%'"); while(cn.rs.next()) { txtUsername.setText(cn.rs.getString(3)); txtPwd.setText(cn.rs.getString(4)); txtRegDate.setText(cn.rs.getString(5)); } }catch (Exception ex) { JOptionPane.showMessageDialog(null,"Error:"+ex.getMessage().toString()); } } } } private void Update() { flag = false; try { stmt.executeUpdate("insert into users values('"+txtFullName.getText()+"','"+txtUsername.getText()+"','"+txtPwd.getText()+"')"); flag=true; }catch(Exception ex) { flag = false; JOptionPane.showMessageDialog(null, ex.getMessage().toString()); } } private void addCourses() { if(validateFormC()) { if(cn.sqlConnect()) { cn.execUpdate("insert into courses values ('"+courseid+"','"+coursename+"','"+duration+"','"+tutionfee+"')"); JOptionPane.showMessageDialog(null, "Course added successfully."); Cclear(); } else { JOptionPane.showMessageDialog(null, "Course NOT added."); Cclear(); } } } private boolean validateFormC() { getFieldsC(); flag = false; if(courseid.equals("") || coursename.equals("") || duration.equals("") || tutionfee.equals("")) { flag = false; JOptionPane.showMessageDialog(null, "All fields are required."); txtCourseName.requestFocus(); } else { flag=true; } return flag; } private void getFieldsC() { courseid = txtCourseID.getText(); coursename = txtCourseName.getText(); duration = txtDuration.getText(); tutionfee = txtTutionFee.getText(); } private void Cclear() { txtCourseID.setText(""); txtCourseName.setText(""); txtDuration.setText(""); txtTutionFee.setText(""); txtCourseName.requestFocus(); } private void CUpdate() { flag = false; try { stmt.executeUpdate("insert into courses values('"+txtCourseID.getText()+"','"+txtCourseName.getText()+"','"+txtDuration.getText()+"','"+txtTutionFee.getText()+"')"); flag=true; }catch(Exception ex) { flag = false; JOptionPane.showMessageDialog(null, ex.getMessage().toString()); } } private void addBatches() { if(validateFormB()) { if(cn.sqlConnect()) { cn.execUpdate("insert into batches values ('"+batchid+"','"+batchname+"','"+starttime+"','"+endtime+"')"); JOptionPane.showMessageDialog(null, "Batch added successfully."); Bclear(); } else { JOptionPane.showMessageDialog(null, "Batch NOT added."); Bclear(); } } } private boolean validateFormB() { getFieldsB(); flag = false; if(batchid.equals("") || batchname.equals("") || starttime.equals("") || endtime.equals("")) { flag = false; JOptionPane.showMessageDialog(null, "All fields are required."); txtBatchName.requestFocus(); } else { flag=true; } return flag; } private void getFieldsB() { batchid = txtBatchID.getText(); batchname = txtBatchName.getText(); starttime = txtStartTime.getText(); endtime = txtEndTime.getText(); } private void Bclear() { txtBatchID.setText(""); txtBatchName.setText(""); txtStartTime.setText(""); txtEndTime.setText(""); txtBatchName.requestFocus(); } private void Bupdate() { flag = false; try { stmt.executeUpdate("insert into batches values('"+txtBatchID.getText()+"','"+txtBatchName.getText()+"','"+txtStartTime.getText()+"','"+txtEndTime.getText()+"')"); flag=true; }catch(Exception ex) { flag = false; JOptionPane.showMessageDialog(null, ex.getMessage().toString()); } } private void addFaculty() { if(validateFormF()) { if(cn.sqlConnect()) { cn.execUpdate("insert into faculty values ('"+facultyid+"','"+facultyname+"','"+gender+"','"+contact+"',"+address+"')"); JOptionPane.showMessageDialog(null, "Faculty added successfully."); Fclear(); } else { JOptionPane.showMessageDialog(null, "Faculty NOT added."); Fclear(); } } } private boolean validateFormF() { getFieldsF(); flag = false; if(facultyid.equals("") || facultyname.equals("") || gender.equals("") || contact.equals("") || address.equals("")) { flag = false; JOptionPane.showMessageDialog(null, "All fields are required."); txtFacultyName.requestFocus(); } else { flag=true; } return flag; } private void getFieldsF() { facultyid = txtFacultyID.getText(); facultyname = txtFacultyName.getText(); gender = txtGender.getText(); contact = txtContact.getText(); address = txtAddress.getText(); } private void Fclear() { txtFacultyID.setText(""); txtFacultyName.setText(""); txtGender.se
    10 pointsBadges:
    report
  • carlosdl
    StudentRegistration, I would recommend posting only the relevant portions of code. Also, please let us know the line of code that is generating the error. Thanks,
    68,525 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following