PDA

Click to See Complete Forum and Search --> : DataEnvironment / Parameter Query Question


Rev. Michael L. Burns
Mar 24th, 2000, 09:04 PM
In one of my projects I can click on a button and execute a parameter query in the dataenvironment against the LastName field of my database. The parameter is passed from the user input into a input box. I thought everything was working fine. It returns the expected results as long as I enter the name exactly.

However, I get no results if the last name is incomplete. What I want to do is be able to enter something like "bu" and have it return all records that have "bu" in the last name, such as burns, Burns, buttonwood, burnside, burg, butler, etc. The code I am currently using is listed below.

SELECT ContactDate, FirstName, LastName, Address, City, Country,
`Contact Type`, `Denominatinal Background`, EmailName,
PostalCode, StateOrProvince, WorkPhone, `Brief Note`,
Notes
FROM `General Conference Contacts`
WHERE (LastName = ?)
ORDER BY ContactDate

Any help here will be most appreciated.

Thanks,
Rev. Michael L. Burns

JHausmann
Mar 24th, 2000, 11:52 PM
try :

SELECT ContactDate, FirstName, LastName, Address, City, Country,
`Contact Type`, `Denominatinal Background`, EmailName,
PostalCode, StateOrProvince, WorkPhone, `Brief Note`,
Notes
FROM `General Conference Contacts`
WHERE (LastName like ? )
ORDER BY ContactDate

Note: you'll want to append "*" (or "%", depending on the dbms) to the end of the data that represents the input parm. That, or make the user do it.