ADO.NET/Access "LIKE" predicate fails

DQtotherescue

New Member
I'm having a bit of trouble with ADO.NET and an Access 2K database I'm developing. <BR><BR>This problem only seems to appear when I use the "LIKE" predicate in an access query and try to return a populated table using system.oledb calls. <BR><BR>For example... <BR><BR>SELECT strFirstName FROM myTable WHERE myTable.strFirstName LIKE "Bob"; <BR>(note: *Bob*, *o*, and * also fail) <BR><BR>This query works perfectly when tested within Access, returning all instances of our friend "Bob". However should you create the connection, command, dataset and table using ADO.NET and oledb, it consistently returns an empty table with no Exceptions being thrown. <BR><BR>If I specify equality in this very same query like so : <BR><BR>SELECT strFirstName FROM myTable WHERE myTable.strFirstName = "Bob"; <BR><BR>The query returns all instances of "Bob" in both Access and the resulting OleDB.DataSet("tablename) using ADO.NET. <BR><BR>I first discovered this problem when trying to create parameterized queries using the "LIKE" predicate but soon discovered it effects all queries that use the "LIKE" predicate. <BR><BR>Does anyone have the slightest idea of why this may be happening and how I may work around the issue without switching to SQL server? <BR><BR><BR>Regards, <BR>Tony Twell you should switch to SQL Ser.. er.. er.. uhm yeah, ok, hehe.<BR><BR>No seriously, can you post more about your connection, command, and dataset objects? Like what parameters or attributes? I haven't experienced THIS particular problem, but when I do have problems where Query-Works-in-DB-Platform, but not on Server App, there's usually a problem with the way I'm connecting to the DB, or what cursor type, or something... You may just try playing with some of those options and see if you get better results.SELECT strFirstName FROM myTable WHERE myTable.strFirstName LIKE "Bob%";Using % instead of * was the answer!<BR><BR>It breaks the query within Access but the OleDB call works perfectly now! Thanks again!<BR><BR>Thanks again!!
 
Back
Top