Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problems in inserting data to MS Access Database

 
Ashok Pradhan
Ranch Hand
Posts: 180
Eclipse IDE Firefox Browser Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a table named Questions
Columns are:-
Columns DataType
ID -AutoNumber
QUESTION -Memo
OPTION_A -Memo
OPTION_B -Memo
OPTION_C -Memo
OPTION_D -Memo
EXPLANATION -Memo
POS_MARK - Number

This is my program to insert some value in question Table (Yes I have created DSN named QuizExam)
but this generate an error:-

Exception in thread "main" java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression 'What is your Name'.
at sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6957)
at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:7114)
at sun.jdbc.odbc.JdbcOdbc.SQLExecDirect(JdbcOdbc.java:3110)
at sun.jdbc.odbc.JdbcOdbcStatement.execute(JdbcOdbcStatement.java:338)
at sun.jdbc.odbc.JdbcOdbcStatement.executeUpdate(JdbcOdbcStatement.java:288)
at AccessConn.main(AccessConn.java:58)

Process completed.




 
Scott Selikoff
author
Saloon Keeper
Posts: 4010
18
Eclipse IDE Flex Google Web Toolkit
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use a PreparedStatement, they are far superior to Statements and would likely resolve what looks like a data encoding issue (you didn't put quotes around the values).
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic