File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes autoNumber problem with MS access Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Databases » JDBC
Bookmark "autoNumber problem with MS access" Watch "autoNumber problem with MS access" New topic
Author

autoNumber problem with MS access

taha khalid
Greenhorn

Joined: May 22, 2012
Posts: 5
Hi

I'm trying to make a search bar in java that searchs through a MS access DB .. specifically in a field that holds autoNumber format variables .. the problem that I have is the variable that gets the search value from a text field (I converted it to integer to be comparable with the autoNumber ) this approach is not working but when I change the variable that gets the text field from integer to string and change the autoNumber to a string value the code works.




Please help
Wei Dai
Ranch Hand

Joined: Jun 22, 2005
Posts: 86
Try
Wendy Gibbons
Bartender

Joined: Oct 21, 2008
Posts: 1107

Hi you two I have added code tags to both of your posts, see how much nicer it looks.
For starters you can tell which quotes you have.
Baseet Ahmed
Ranch Hand

Joined: Dec 18, 2006
Posts: 224
AsSalaamualaikum Taha khalid:

String sql = "select ID from student_info where ID ='"+a+"'";


What is the data type of your ID column in MS Access DB?

You are using variable a with single quote(' '). So check if it Integer(Number) or string(Text).


--------
Regards
Ahmed
 
GeeCON Prague 2014
 
subject: autoNumber problem with MS access