The Artima Developer Community
Sponsored Link

Java Answers Forum
Data type mismatch in criteria expression?

2 replies on 1 page. Most recent reply: Jul 13, 2002 2:18 PM by john

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 2 replies on 1 page
john

Posts: 10
Nickname: swing
Registered: Jul, 2002

Data type mismatch in criteria expression? Posted: Jul 12, 2002 11:17 PM
Reply to this message Reply
Advertisement
I tried to query with following codes

String query = "SELECT * FROM table" +
"WHERE ID=" +
Long.parseLong(fields.getText());
ResultSet rs = Statememt.executeQuery(query);

//data type of ID is long integer, table in a
//"ACCESS" database file
......

when I run the program, I got run time error
"Data type mismatch in criteria expression"?

I just don't know how to solve this problem.

Help please.


john

Posts: 10
Nickname: swing
Registered: Jul, 2002

Re: Data type mismatch in criteria expression? Posted: Jul 13, 2002 11:45 AM
Reply to this message Reply
Sorry guys, the data type of ID is number.

john

Posts: 10
Nickname: swing
Registered: Jul, 2002

Re: Data type mismatch in criteria expression? Posted: Jul 13, 2002 2:18 PM
Reply to this message Reply
Still working on that damn codes. got really frustrated. Hope someone would help me out.

Let me state the problem again.
the table has 3 columns

column data type
ID AutoNumber
AssemblyPN Text
PartNo Number

I use JTextField to get user input, then do query.

Here are codes for the query part.

String query = "SELECT * FROM Assembly" +
" WHERE AssemblyPN = " +
aPanel.AssemblyPN.getText() ;
ResultSet rs = st.executeQuery(query);

The above codes don't work, got run time error message
"Data type mismatch in criteria expression"

but if change codes as:
String query = "SELECT * FROM Assembly" +
" WHERE ID = " +
aPanel.AssemblyID.getText() ;
ResultSet rs = st.executeQuery(query);

the codes work. I just don't understand why

" WHERE AssemblyPN = " +
aPanel.AssemblyPN.getText()..

doesn't work!!!!!

Flat View: This topic has 2 replies on 1 page
Topic: Need help with arrays and strings Previous Topic   Next Topic Topic: Help with Data exchange

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use