Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
pog
Newbie


Joined: 17 Nov 2005
Posts: 2

PostPosted: Thu Nov 17, 2005 2:10 pm   

Problem with LIKE in ADO SQL command
 
Hi,

I wonder if anyone can help me. I've recently set up a database in Access2000 format for storing SWs etc. Using ADO I can link to the database fine and retrieve info.

I've tried to add LIKE to my SQL command, but no records are returned - however if I c&p the SQL command into access it works fine. Any ideas what I can do to fix it?

An example SQL command:
SELECT * FROM qryAreaSWs WHERE AREA_NAME LIKE 'A*'

and the code that creates/exectues it:
#VAR Conn %comcreate( "ADODB.Connection")
#CALL @Conn.Open( "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\zmud\aardwolf\DB\tip.mdb")
#VAR SQL "SELECT * FROM qryAreaSWs WHERE AREA_NAME LIKE '%1*'"
#ECHO Debug: Sql = @SQL
#VAR rs @Conn.Execute(@SQL)
#IF @rs.Eof {#ECHO No matching SWs found} {#ECHO @rs.GetString}
#CALL @rs.Close
#VAR rs ""
#VAR Conn ""

rs.Eof is always True after the Conn.Execute, even though running the same SQL command in Access returns a whole host of records.

Any help is appreciated.

Thanks,

Pog
Reply with quote
Guinn
Wizard


Joined: 03 Mar 2001
Posts: 1127
Location: London

PostPosted: Thu Nov 17, 2005 4:18 pm   
 
Take a glance at
http://forums.zuggsoft.com/phpbb/viewtopic.php?t=20089

Was a question I posted a while ago about triggering from a MySQL database, but in the answers it filtered the db using LIKE commands. Might help you.
Reply with quote
pog
Newbie


Joined: 17 Nov 2005
Posts: 2

PostPosted: Thu Nov 17, 2005 10:53 pm   
 
Thanks for that.

Noticed on the very last note that you were using LIKE % rather than LIKE *.

Even though access was happy with the SQL statement "SELECT * FROM qryAreaSWs WHERE AREA_NAME LIKE '%1*'"
it needs to be "SELECT * FROM qryAreaSWs WHERE AREA_NAME LIKE '%1%'" from within zMud.

Problem solved, and I'm happy :)

Once again, thanks for the tip.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net