Missing operator in query expression (Help)

Hi I'm trying to implement "OR" into my SQL statement and I think I'm doing something wrong.. Could someone take a quick look at my query and tell me where I'm missing this operator.

int insert=stmt.executeUpdate("INSERT INTO tblTest(EnglishName, FileName, RlsID, InitRlsInd, DirID, ObsoleteRlsInd) VALUES

("+"\'"+jTextFieldName.getText()+"\'"+","+

"\'"+jTextFieldFileName.getText()+"\'"+","+

"\'"+getComboID(jComboBoxRelease)+"\'"+","+

"\'"+getRadioID(jRadioButtonInitRlsY)+"\'"+","+"OR"+getRadioID (jRadioButtonInitRlsN)+"\'"+","+

"\'"+getComboID(jComboBoxDirectory)+"\'"+","+

"\'"+getRadioID(jRadioButtonObsoRlsY)+"\'"+","+"OR"+getRadioID(jRadioButtonObsoRlsN)+"\'"+ ")");

Thanks in advance.

[773 byte] By [mattv6603a] at [2007-10-3 3:48:20]
# 1
Forget this **** and use a PreparedStatement. That will clear up your syntax and probably get rid of your bug as well.
cotton.ma at 2007-7-14 21:45:21 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 2
awesome! I was wondering if there was an alternative method of writing a SQL statement in Java.. all those "" and stuff were brutal....Thanks
mattv6603a at 2007-7-14 21:45:21 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 3

> awesome! I was wondering if there was an alternative

> method of writing a SQL statement in Java.. all

> those "" and stuff were brutal....

>

> Thanks

Yes. Also PreparedStatements will handle the formatting of data values. That means the proper escaping of quotes within text and db specific date formats. etc.

cotton.ma at 2007-7-14 21:45:21 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 4

cotton if your still out there..

String sql = "INSERT INTO tblTest("

+ "EnglishName,"

+ "FileName,"

+ "RlsID,"

+ "InitRlsInd,"

+ "DirID,"

+ "ObsoleteRlsInd,"

+ "VALUES(?,?,?,?,?,?)";

PreparedStatement pstmt = dB.prepareStatement(sql);

Now if I use pstmt and continue my INSERT I am not able to implement the values the users will put into the text and combo boxes..

I tried this for the textbox, but it doesn't work... pstmt.setString(jTextFieldName.getText()); I know this is obviously wrong, but I'm unfirmilar with prepared statments and I looked at the Java Docs and they don't show a specific example for what I want to do.. Atleast what I found doesnt. Could you show me a quick example?

Thanks,

mattv6603a at 2007-7-14 21:45:21 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 5
More likepstmt.setString(1, jTextFieldName.getText());if you wanted to put that text into the first bound variable (the first ? if you like). You left off the first parameter.
DrClapa at 2007-7-14 21:45:21 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...