Dhanish 0 Newbie Poster

hi to all....i have a video club system where am using an sql server to store records about films....i successfully created the database, the table and input data data into the database using the SQL Command window in netbeans.....however when i use the JOption Pane to input data the VideoName and Category fields return an eror when i input words in them..they seem to accept only integers

i cuurently have 3 files + my database

1. Table file in database

CREATE TABLE films (
    VideoId MEDIUMINT NOT NULL AUTO_INCREMENT,
    VideoName CHAR(30) NOT NULL,
    Category CHAR(20) NOT NULL,
    Quantity INT NOT NULL,
    LoanDate DATE,
    ReturnDate DATE,
    CustId MEDIUMINT,
    PRIMARY KEY (VideoId)
);

2. Main.java

public class Main
{
    public static void main(String[] args)
    {
        Menu mm= new Menu();
        mm.setVisible(true);
    }

}

3. Menu.java

import javax.swing.JOptionPane;
import java.sql.Date;

public class Menu extends javax.swing.JFrame
{
    public Menu()
    {
        initComponents();
    }

    Video c = new Video();

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {                                         
        // insert a new record
        String name;
        name = JOptionPane.showInputDialog(null, "Enter Video Name: ", "Video Name", JOptionPane.QUESTION_MESSAGE);
        c.video_name=(name);

        if(c.CheckIfRowExists(name))
        {
            JOptionPane.showMessageDialog(null, "Video Already Exists...Please Enter Another Name!", "Error", JOptionPane.WARNING_MESSAGE);
        }

        String category;
        category = JOptionPane.showInputDialog(null, "Enter Video Category: ", "Video Category", JOptionPane.QUESTION_MESSAGE);
        c.category=category;

        String quantity;
        quantity = JOptionPane.showInputDialog(null, "Enter Quantity: ", "Video Quantity", JOptionPane.QUESTION_MESSAGE);

        while(Integer.parseInt(quantity)<1)
        {
            quantity = JOptionPane.showInputDialog(null, "Number Invalid...Please Re-Enter Quantity: ", "Error", JOptionPane.WARNING_MESSAGE);
        }

        c.addQuantity(Integer.parseInt(quantity));

        c.NewRecord(name, category, Integer.parseInt(quantity));

        JOptionPane.showMessageDialog(null, "New Video Successfully Added!", "Success", JOptionPane.INFORMATION_MESSAGE);
    }
}

4. Video.java

import java.sql.*;
import java.sql.Date;
import java.sql.ResultSet;
import javax.swing.JOptionPane;

public class Video
{
    int video_id, quantity, cust_id;
    String video_name, old_video_name, category;
    Date loan_date, old_loan_date, return_date, old_return_date;

    public static String ConnStr="jdbc:mysql://localhost:3306/videoclub";
    private static String Username="root";
    private static String Password="StrategieS";

    public Video()
    {
        this.quantity = 0;
        this.video_name = "NULL";
        this.category = "NULL";
    }

    public void executeUpdate(String Query)
    {
        try
        {
            Statement stat;
            Connection con = DriverManager.getConnection(ConnStr,Username,Password);
            stat = con.createStatement();
            stat.executeUpdate(Query);
            con.close();
        }

        catch(Exception e)
        {
            e.printStackTrace();
        }
    }

    public void executeQuery(String Query)
    {
        try
        {
            Statement stat;
            Connection con = DriverManager.getConnection(ConnStr,Username,Password);
            stat = con.createStatement();
            stat.executeQuery(Query);
            con.close();
        }

        catch(Exception e)
        {
            e.printStackTrace();
        }
    }

    public boolean CheckIfRowExists(String f)
    {
        this.video_name=f;
        try
        {
            Statement stat;
            Connection con = DriverManager.getConnection(ConnStr,Username,Password);
            stat = con.createStatement();
            ResultSet rs = stat.executeQuery("SELECT COUNT(*) FROM films WHERE VideoName = "+old_video_name+"");
            rs.first();

            int count = Integer.parseInt(rs.getString(1));

            if(count!=0)
            {
                return true;
            }

            con.close();
        }

        catch(Exception e)
        {
            e.printStackTrace();
        }

        return false;
    }

    void NewRecord(String a, String b, int c)
    {
        this.video_name = a;
        this.category = b;
        this.quantity = c;

        executeUpdate("INSERT INTO films(VideoName, Category, Quantity) VALUES("+video_name+", "+category+", "+quantity+")");
    }
}

Note :- for the files video.java and menu.java i have only posted the part of the program relative to my problem....it's not complete