Re: ADO.NET not retrieving results correctly

From: Robert Gaston (nospam)
Date: 02/03/05


Date: Wed, 2 Feb 2005 21:44:16 -0600

Not positive this is it, but you might try % as the wildcard instead of *,
and possibly drop the parentheses around the various joins, for a less
Access-ish syntax

"Matt Michael" <no@spamforme.com> wrote in message
news:%23q6Dn9ZCFHA.1836@tk2msftngp13.phx.gbl...
> I'm using ADO .NET to connect to a Microsoft Access database, and
> everything so far has been working in my program except one small problem.
> I am constructing a query string to search for certain results from a
> table, and it does not seem to return the correct results.
>
>
> Dim dtResults As New DataTable("SearchResults")
>
> Dim cmdSearchResults As New OleDb.OleDbCommand(queryString,
> appointments.myConnection)
> Dim daSearchResults As New OleDb.OleDbDataAdapter(cmdSearchResults)
>
> daSearchResults.Fill(dtResults)
>
> Debug.WriteLine(dtResults.Rows.Count)
> Debug.WriteLine(queryString)
>
> where queryString is the string I have constructed. It looks like this:
>
> SELECT Appointments.AppointmentID, Appointments.AppointmentTime,
> Buildings.Building, Appointments.RoomNumber, Appointments.Details FROM
> (Appointments INNER JOIN Buildings ON
> Appointments.BuildingID=Buildings.BuildingID) INNER JOIN Technicians ON
> Appointments.TechnicianID=Technicians.TechnicianID WHERE 1 = 1 AND
> Technicians.TechnicianName = "Matt" AND Appointments.Details LIKE
> "*test*";
>
>
> When I copy this directly into a query in MS Access it returns the correct
> records, however the data adapter in my code returns 0 results. Whenever I
> remove the LIKE clause it seems that my queries do return results back to
> the data table. Is there something buggy with using the LIKE clause to
> send queries through ADO? Any ideas as to what the problem is anyone?
>
>
> -Matt



Relevant Pages

  • Re: JOIN on multiple conditions
    ... You must use the OUTER JOIN syntax, of course, ... >but if you learn only the INNER JOIN syntax does it change the way you ... More complicated queries should not be written by ... condition is placed in the ON or in the WHERE clause. ...
    (microsoft.public.sqlserver.programming)
  • Re: Getting the High and Low Tides from a Series of Data
    ... > queries, sub queries and virtual table) will extract all occurrences ... > SELECT ActionID, MINAs mi, MAXAs ma ... > FROM myTable INNER JOIN query1 ... > a WHERE clause, if you prefer: ...
    (microsoft.public.excel.misc)
  • Re: Getting the High and Low Tides from a Series of Data
    ... > queries, sub queries and virtual table) will extract all occurrences ... > SELECT ActionID, MINAs mi, MAXAs ma ... > FROM myTable INNER JOIN query1 ... > a WHERE clause, if you prefer: ...
    (microsoft.public.access.gettingstarted)
  • Re: Getting the High and Low Tides from a Series of Data
    ... > queries, sub queries and virtual table) will extract all occurrences ... > SELECT ActionID, MINAs mi, MAXAs ma ... > FROM myTable INNER JOIN query1 ... > a WHERE clause, if you prefer: ...
    (microsoft.public.access.queries)
  • Re: Employees Pay Rate
    ... Now, for an INNER JOIN, you start with a CROSS JOIN, but you keep only the ... records where the ON clause evaluates to FALSE or NULL). ... FROM (tableOne As a INNER JOIN tableTwo As b ... GREATER the dateNewSal actually pointed by the second hand. ...
    (microsoft.public.access.queries)