| Author |
Problem with inserting into MS Access Memo field.
|
Stavya Grover
Greenhorn
Joined: Apr 22, 2011
Posts: 3
|
|
Hi, I have an ODBC named store in MS Access. There's a table called desc which has bookId(Number) and summary(Memo).
My code to insert data into the table is:
The output which I am getting in Netbeans is:
Errors!
[Microsoft][ODBC Microsoft Access Driver] Syntax error in INSERT INTO statement.
BUILD SUCCESSFUL (total time: 0 seconds)
Any help,please?
|
 |
Rob Spoor
Sheriff
Joined: Oct 27, 2005
Posts: 19216
|
|
Have you tried the following:
- psumm.setString(2, summary);
- psumm.setCharacterStream(2, new StringReader(summary));
- psumm.setClob(2, new StringReader(summary));
Or, for unicode:
- psumm.setNString(2, summary);
- psumm.setNCharacterStream(2, new StringReader(summary));
- psumm.setNClob(2, new StringReader(summary));
|
SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
|
 |
Stavya Grover
Greenhorn
Joined: Apr 22, 2011
Posts: 3
|
|
1. The table in MS Access cannot have a name desc, so changed the name,still, the above are not working.
2. setString gives : General error
3.psumm.setCharacterStream(2, new StringReader(summary)); gives: [Microsoft][ODBC Microsoft Access Driver]COUNT field incorrect
4.psumm.setClob(2, new StringReader(summary)); also gives: [Microsoft][ODBC Microsoft Access Driver]COUNT field incorrect
Is there a way to convert the string to a Clob and then use setClob()? And if I am using CLOBS, the data type in MS Access should be what?
I've got a project to submit tomorrow, this is taking too much time! Can't find the solution, I just need to store looooooong strings in MS Access. Suggest a way,please!
|
 |
Rob Spoor
Sheriff
Joined: Oct 27, 2005
Posts: 19216
|
|
A few more attempts:
You can also try to convert the column to Text. If I recall correctly that can handle large amounts of text as well.
|
 |
Stavya Grover
Greenhorn
Joined: Apr 22, 2011
Posts: 3
|
|
It worked!
I just had to change the table name to something else than desc. The code I posted worked with memo.
I'll try out your suggestions also. Thanks!
|
 |
Rob Spoor
Sheriff
Joined: Oct 27, 2005
Posts: 19216
|
|
|
You're welcome.
|
 |
 |
|
|
subject: Problem with inserting into MS Access Memo field.
|
|
|