Tom, in the ColdFusion code that handles the form submission, you can do
something like this:
<cfquery name="getAllFields" datasource="yourDatasource">
describe yourTableName
</cfquery>

That query will get a list of all of the fields of your table. Then, in your
search query, you can loop through them like this:
<cfoutput>
<cfquery name="search" datasource="yourDatasource" >
select *
from yourTableName
where
<cfloop query="getAllFields">
       <cfif currentRow gt 1 > or </cfif> #field# like <cfqueryparam
cfsqltype="cf_sql_varchar" value="%#form.yourTextInput#%" />
</cfloop>
</cfquery>
</cfoutput>

That will search every field in your table for a match to the text field
contents from the form they submitted. Good luck.




On Thu, Jul 23, 2009 at 8:17 PM, Tom Jones <[email protected]> wrote:

>
> Sorry, I thin I might not explained my self very well. Al though the
> "cfdbinfo" looks really cool and I think I can use it in a report
> generator tool I want to do, so thanks.
>
> So what I want is a single form field that will search the entire
> table without having to specify which column.
>
> Thanks,
> tom
>
>
>
> On Jul 23, 2009, at 9:24 AM, cftalk wrote:
>
> >
> > You can also this little gem (cfdbinfo)
> > http://www.cfquickdocs.com/cf8/#cfdbinfo
> >
> >
> > -----Original Message-----
> > From: David McGuigan [mailto:[email protected]]
> > Sent: July-22-09 9:23 PM
> > To: cf-talk
> > Subject: Re: WildCard query
> >
> >
> > You can grab a list of all of the columns of any table and loop
> > through them
> > pretty easily ( they syntax varies with your database vendor ).
> >
> > MySQL is just:
> >
> > describe tableName
> >
> >
> > On Wed, Jul 22, 2009 at 9:10 PM, Tom Jones <[email protected]> wrote:
> >
> >>
> >> Hello,
> >> I'm migrating some pages from Lasso to Coldfusion and one of the
> >> current pages in Lasso has a query to search any field/column for a
> >> value. I have never done this with coldsuion before so I'm not sure
> >> how to go about this.
> >>
> >> thanks,
> >> tom
> >>
> >>
> >>
> >>
> >>
> >>
> >
> >
> >
> >
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:324914
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to