SQL like query problem

I have the following SQL query:
SELECT tblDelegate.DelegateTitle, tblDelegate.DelegateName, tblDelegate.DelegateAffiliation FROM tblDelegate WHERE (((tblDelegate.DelegateName) Like '*e?'))

The problem is, that it doesn't generate any results even though the actual Access db query generates 19 results.

This is the form for it:

<% If ((Request.QueryString("delegate") = "lettere")) %>

    <form runat="server">
      <asp:DataList id="lettere" runat="server" width="80%">

        <ItemTemplate>
          <center><h3><%#Container.DataItem("DelegateName")%></h3></center>
          <b>Title:</b><%#Container.DataItem("DelegateTitle")%>
          <b>Affiliation:</b><%#Container.DataItem("DelegateAffiliation")%>
          <br><br><br>
        </ItemTemplate>

      </asp:DataList>
    </form>

Has anyone got any ideas?

This question follows on as the second part of the question on this page:
http://www.experts-exchange.com/Programming/Programming_Languages/Dot_Net/ASP_DOT_NET/Q_21415986.html
It is the second of two problem I have had with the database.

Thanks in advance.
DanBAtkinsonAsked:
Who is Participating?
 
laotzi2000Connect With a Mentor Commented:
Try change
Like '*e?'
To
Like '%e_'
0
 
DanBAtkinsonAuthor Commented:
Sorry, that's mySQL syntax and it doesn't work in an Access database which is what mine is.
0
 
DanBAtkinsonAuthor Commented:
Ok. Today is being a very weird day...

So... The query syntax '*e?' works in Access but '%e_' doesn't work because Access does not recognise % and _ as correct syntax.

I have actually tried that method further down the page:
http://www.webthang.co.uk/tuts/tuts_dbase/sql_raed2/r_sql_2.asp

...in access as a query but it didn't recognise % or _. Never mind, it works. Only that I didn't think it would!!!

Points awarded to laotzi2000 and I deserve a slap around the head for thinking that Access knew best! :p
0
 
laotzi2000Commented:
in fact that's ado wildcard: % and _
if you run the query in access, you should use * and ?
but with ado, you should use % and _
0
 
DanBAtkinsonAuthor Commented:
Ok. Thanks! Yes. ADO! I meant ADO really! ;) I've just spent an hour in a seminar about it!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.