Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: Need Help

  1. #1
    Junior Member
    Join Date
    Jun 2014
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Need Help

    I have an error :

    You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'tbldetailbrgmasuk.nonota=''' at line 1


    this my coding :

    String data[]=new String[6];
    private void setDefaultTable() {
    String stat ="";
    try {
    Class.forName(driver);
    Connection kon = DriverManager.getConnection(database,user,pass);
    Statement stt = kon.createStatement();
    String SQL = "SELECT tblbarang.kodebarang,tblbarang.namabarang,tblbaran g.hargajual," + "tblbarang.stok,tbldetailbrgmasuk.jumlah,tbldetail brgmasuk.subtotal,tblbrgmasuk.nonota " +"FROM tblbarang,tbldetailbrgmasuk,tblbrgmasuk WHERE tblbarang.kodebarang=tbldetailbrgmasuk.kodebarang " +
    "AND tblbrgmasuk.nonota=tbldetailbrgmasuk.nonota" +
    "AND tbldetailbrgmasuk.nonota='"+NoNota.getText()+"'";
    ResultSet res = stt.executeQuery(SQL);
    while(res.next()){
    data[0] = res.getString(1);
    data[1] = res.getString(2);
    data[2] = res.getString(3);
    data[3] = res.getString(4);
    data[4] = res.getString(5);
    data[5] = res.getString(6);
    tableModel.addRow(data);
    }
    res.close();
    stt.close();
    kon.close();
    } catch (Exception ex) {
    System.err.println(ex.getMessage());
    }
    }

  2. #2
    Junior Member
    Join Date
    Jun 2014
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Need Help, please

    I have an error :

    You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'tbldetailbrgmasuk.nonota=''' at line 1


    this my coding :

    String data[]=new String[6];
    private void setDefaultTable() {
    String stat ="";
    try {
    Class.forName(driver);
    Connection kon = DriverManager.getConnection(database,user,pass);
    Statement stt = kon.createStatement();
    String SQL = "SELECT tblbarang.kodebarang,tblbarang.namabarang,tblbaran g.hargajual," + "tblbarang.stok,tbldetailbrgmasuk.jumlah,tblde tail brgmasuk.subtotal,tblbrgmasuk.nonota " +"FROM tblbarang,tbldetailbrgmasuk,tblbrgmasuk WHERE tblbarang.kodebarang=tbldetailbrgmasuk.kodebarang " +
    "AND tblbrgmasuk.nonota=tbldetailbrgmasuk.nonota" +
    "AND tbldetailbrgmasuk.nonota='"+NoNota.getText()+"'";
    ResultSet res = stt.executeQuery(SQL);
    while(res.next()){
    data[0] = res.getString(1);
    data[1] = res.getString(2);
    data[2] = res.getString(3);
    data[3] = res.getString(4);
    data[4] = res.getString(5);
    data[5] = res.getString(6);
    tableModel.addRow(data);
    }
    res.close();
    stt.close();
    kon.close();
    } catch (Exception ex) {
    System.err.println(ex.getMessage());
    }
    }

  3. #3
    Member Abhilash's Avatar
    Join Date
    Jun 2014
    Location
    Kolkata, West Bengal, INDIA
    Posts
    108
    My Mood
    Busy
    Thanks
    5
    Thanked 10 Times in 10 Posts

    Default Re: Need Help

    Welcome to the forum. Please read this topic to learn how to post code in code or highlight tags and other useful info for new members.

    You didn't need to post your problem twice. Also for readability, post your program this way . And please post the error too along with the whole program. We need the specifics.

    Thank You.