Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

problem in generating query in MSAccess

 
parag dharmadhikari
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI all,
I want to generate a query for MS Access.I have to build it using MSAccess wild char "*".
my query statement is
query="select * from "+table+" where "+colarr.elementAt(0)+" like '"+valarr.elementAt(0)+"*"+"' ";
where all variables are decleared properly. here my problem is there is no syntax or runtime error but after firing the query I can not get the output as resultset is zero though data is present. Without wild char. it works fine.
can anybody pls help me

 
Jamie Robertson
Ranch Hand
Posts: 1879
MySQL Database Suse
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When I use MSAccess and java, the wild card is '%'. try the same query using '%' and you should be fine
Jamie
 
Jason Kilgrow
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by parag dharmadhikari:
HI all,
I want to generate a query for MS Access.I have to build it using MSAccess wild char "*".
my query statement is
query="select * from "+table+" where "+colarr.elementAt(0)+" like '"+valarr.elementAt(0)+"*"+"' ";
where all variables are decleared properly. here my problem is there is no syntax or runtime error but after firing the query I can not get the output as resultset is zero though data is present. Without wild char. it works fine.
can anybody pls help me

Try some sample queries in Access before you code them.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic