aspose file tools*
The moose likes JDBC and the fly likes COUNT field incorrect or syntax error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "COUNT field incorrect or syntax error" Watch "COUNT field incorrect or syntax error" New topic
Author

COUNT field incorrect or syntax error

Yohan Weerasinghe
Ranch Hand

Joined: Oct 07, 2010
Posts: 499

Hi,

when I run my servlet, I am getting the error " java.sql.SQLException: [Microsoft][ODBC SQL Server Driver]COUNT field incorrect or syntax error". My servlet, database table code and all the necessary things are below.


Form.html



SaveData.java



My database table is below



Following is my web.xml file




In my SaveData.java file, is I remove the comment symbol "//" it passes " Number Format Exception". When I put the comment line and run, it passes the previous error, which is bothering me (I guess NumberFormat Error also a part of it, at least I have seen that before but the NEW error is DANGEROUS!). Please help me. Thanks


Are you better than me? Then please show me my mistakes..
Yohan Weerasinghe
Ranch Hand

Joined: Oct 07, 2010
Posts: 499

Apart from that I am using the same DATABASE under the SAME DSN in my NON SERVLET java applications. All are working fine without any error. I just checked this with my desktop and laptop with NetBeans and Manually, but no good
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61773
    
  67

Moved to the JDBC forum.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Miku Ranjan
Ranch Hand

Joined: Oct 11, 2011
Posts: 98
Hi,
Can you show here full stack trace error so it will easy to detect the error.
Yohan Weerasinghe
Ranch Hand

Joined: Oct 07, 2010
Posts: 499

Bear Bibeault wrote:Moved to the JDBC forum.


Thanks for moving this thread Bear Bibeault . I really appreciate that.
Yohan Weerasinghe
Ranch Hand

Joined: Oct 07, 2010
Posts: 499

Miku Ranjan wrote:Hi,
Can you show here full stack trace error so it will easy to detect the error.


Hi Miku,

Thanks a lot for trying to help me out, and I really appreciate it. Anyway my lecturer solved that out today. Here are the reasons for the error.

For the NumberFormat Exception error which comes out without any reasonable reason, the answer is, USE TRIM() METHOD WHEN YOU ARE CONVERTING THAT TO NUMERIC. Seems like it has lot of junk spaces, LOL.

For the SQL Exception error, the answer is, use SYSTEM DSN CONFIGURATION. DO NOT CREATE A NEW DSN, CONFIGURE THE SYSTEM DSN "SQL".


Thanks all of you for trying to help me out.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: COUNT field incorrect or syntax error