Results 1 to 4 of 4
  1. #1
    haoinfo23 is offline Member
    Join Date
    Aug 2013
    Posts
    3
    Rep Power
    0

    Default (Split from) SQLException: [Microsoft][ODBC Microsoft Access Driver] Too few paramete

    sir how about this... i can't fix this.. i need help... im using netbeans....
    here's the codes

    /*
    * To change this template, choose Tools | Templates
    * and open the template in the editor.
    */
    package torch;


    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.SQLException;
    import java.sql.Statement;
    import java.sql.ResultSet;
    import javax.swing.JOptionPane;
    import java.util.*;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.event.*;
    import java.sql.*;
    import java.io.*;

    public class addsched extends javax.swing.JFrame {



    /**
    * Creates new form addsched
    */
    public addsched() {
    initComponents();


    }




    private void initComponents() {

    jLabel1 = new javax.swing.JLabel();
    jLabel2 = new javax.swing.JLabel();
    jLabel3 = new javax.swing.JLabel();
    jLabel5 = new javax.swing.JLabel();
    jTextField1 = new javax.swing.JTextField();
    jTextField2 = new javax.swing.JTextField();
    jTextField3 = new javax.swing.JTextField();
    jButton1 = new javax.swing.JButton();
    jLabel4 = new javax.swing.JLabel();
    jTextField4 = new javax.swing.JTextField();
    jButton2 = new javax.swing.JButton();
    jLabel6 = new javax.swing.JLabel();
    jTextField5 = new javax.swing.JTextField();

    setDefaultCloseOperation(javax.swing.WindowConstan ts.EXIT_ON_CLOSE);
    setResizable(false);



    private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {

    NewJFrame c=new NewJFrame();
    this.setVisible(false);
    c.setVisible(true);
    }

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {

    String eventnum = jTextField5.getText();
    String eventname1 = jTextField4.getText();
    String eventdate1 = jTextField1.getText();
    String eventplace1 = jTextField2.getText();
    String eventtime1 = jTextField3.getText();



    //Check if user has entered required data
    if(eventname1.equals("")||eventdate1.equals("")||e ventplace1.equals("")||eventtime1.equals("")||even tnum.equals("")){
    JOptionPane.showMessageDialog(this, "Please enter required details");
    }
    else
    {
    {
    try
    {
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Connection connection=DriverManager.getConnection("jdbc:odbc: torchsched");
    String sql="INSERT INTO torchsced (eventname,eventdate,eventplace,eventtime,eventid) values("+eventname1+",'"+eventdate1+"','"+eventpla ce1+"','"+eventtime1+"','"+eventnum+"')";
    Statement statement=connection.createStatement();
    statement.execute(sql);
    connection.close();
    JOptionPane.showMessageDialog(null,"Event Added!","Success",JOptionPane.INFORMATION_MESSAGE) ;

    int s=JOptionPane.showConfirmDialog(null,"Add Another Record?","Add",JOptionPane.YES_NO_OPTION,JOptionPa ne.QUESTION_MESSAGE);
    //If the user chose yes
    if(s==JOptionPane.YES_OPTION)
    {

    }
    //If the user chose no
    if(s==JOptionPane.NO_OPTION)
    {
    dispose();
    }
    }
    catch(Exception error)
    {
    JOptionPane.showMessageDialog (null, error,"Database Connection Error!", JOptionPane.ERROR_MESSAGE);
    }
    }
    }
    }

    // Variables declaration - do not modify
    private javax.swing.JButton jButton1;
    private javax.swing.JButton jButton2;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JTextField jTextField1;
    private javax.swing.JTextField jTextField2;
    private javax.swing.JTextField jTextField3;
    private javax.swing.JTextField jTextField4;
    private javax.swing.JTextField jTextField5;
    // End of variables declaration
    }
    Last edited by haoinfo23; 08-13-2013 at 06:50 PM.

  2. #2
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,120
    Rep Power
    20

    Default Re: (Split from) SQLException: [Microsoft][ODBC Microsoft Access Driver] Too few para

    First, don't hijack an existing thread.
    Second, please use [code] tags [/code] when posting code. A lot of people reading this forum will not bother reading unformatted code.
    Third, what exactly is the problem?
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  3. #3
    haoinfo23 is offline Member
    Join Date
    Aug 2013
    Posts
    3
    Rep Power
    0

    Default Re: (Split from) SQLException: [Microsoft][ODBC Microsoft Access Driver] Too few para

    im sorry im new here :(

  4. #4
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,120
    Rep Power
    20

    Default Re: (Split from) SQLException: [Microsoft][ODBC Microsoft Access Driver] Too few para

    Well?
    What's the problem (and please edit your post to add the code tags)?
    Please do not ask for code as refusal often offends.

    ** This space for rent **

Similar Threads

  1. Replies: 2
    Last Post: 04-18-2012, 04:51 PM
  2. Replies: 5
    Last Post: 09-11-2011, 06:13 AM
  3. Replies: 3
    Last Post: 08-15-2011, 11:16 AM
  4. Replies: 2
    Last Post: 08-11-2011, 03:41 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •