Ask a Question related to Dreamweaver AppDev, Design and Development.
-
illufox #1
Search for any column?
I would like to create a search function where people can type anything into
the search field and it will bring up data that matches the search parameter.
So far I'm only able to have them search for parameters in a specific column
with the code below. I don't see an option to have the search look through all
columns instead of just one particular. I've tried to add all columns to the
WHERE statement but that caused an error.
<%
Dim Recordset1
Dim Recordset1_numRows
Set Recordset1 = Server.CreateObject("ADODB.Recordset")
Recordset1.ActiveConnection = MM_EventsDB_STRING
Recordset1.Source = "SELECT IdMeeting, Date_S, EventName, Location,
ProjectLead, Status, TypeOfMeeting, MarketingLead, Industry FROM Meeting WHERE
Industry LIKE '%" + Replace(Recordset1__MMColParam, "'", "''") + "%' ORDER BY
Date_S ASC"
Recordset1.CursorType = 0
Recordset1.CursorLocation = 2
Recordset1.LockType = 1
Recordset1.Open()
Recordset1_numRows = 0
%>
illufox Guest
-
Move bound column to right of dynamic column in datagrid?
I have a datatable that I am binding to a C# ASP.NET 1.1 web page. I also want to put an "Edit" column on the datagrid. However, whenever I use... -
ANN: InterAKT Site Search - search in multiple tables
Hello, We have just released a new product, MX Site Search, meant to help web developers and designers create a search form in their dynamic... -
Bound Column or Template Column (w dAdapater?) in DataGrid
I am able to get the data using DataAdapter and the DataReader. I am more inclined to use DataAdapter because I want to update the data on the SQL... -
#25786 [NEW]: PHP website uses cookies to remember last search phrase in search box
From: tipsen at imada dot sdu dot dk Operating system: - PHP version: Irrelevant PHP Bug Type: Unknown/Other Function Bug... -
how to Add different controls(textBox,DropDownList or some ) in the same column,based upon the value in the previous column (Say second Colum which contain dropdown with some values) ?
I am new to ASP.NET. I am facing problem with datagrid. I will explain prob now. In the datagrid the first column is name in the second... -
Tom Muck #2
Re: Search for any column?
"illufox" <webforumsuser@macromedia.com> wrote in message
news:d1fbf4$n6e$1@forums.macromedia.com...into> I would like to create a search function where people can type anythingparameter.> the search field and it will bring up data that matches the searchcolumn> So far I'm only able to have them search for parameters in a specificthrough all> with the code below. I don't see an option to have the search lookthe> columns instead of just one particular. I've tried to add all columns toYou have to specify each column you want to search (in pseudo-sql):> WHERE statement but that caused an error.
SELECT * FROM mytable
WHERE field1 like '%search%'
AND field2 LIKE '%search%'
AND field3 LIKE '%search%' etc
So basically you would write the SQL exactly as you have done, but include a
filter for each field that you want to search.
If you have my book Dreamweaver MX 2004: The Complete Reference, there is
code that shows how to do it automatically in every server language. I also
have an extension that expands on this code available for a small fee from
[url]http://www.tom-muck.com/extensions/help/DynamicSearchPHP/[/url]
--
-------------------------------------------
Tom Muck
co-author Dreamweaver MX 2004: The Complete Reference
[url]http://www.tom-muck.com/[/url]
Extending Knowledge, Daily
[url]http://www.CommunityMX.com/[/url]
Tom Muck Guest
-
illufox #3
Re: Search for any column?
Ok, I've done that but now I get no results at all. Shouldn't it be 'OR' insted
of 'AND'? Here is the updated code:
Recordset1.Source = "SELECT IdMeeting, Date_S, EventName, Location,
ProjectLead, Status, TypeOfMeeting, MarketingLead, Industry FROM Meeting WHERE
Industry LIKE '%" + Replace(Recordset1__MMColParam, "'", "''") + "%' AND
EventName LIKE '%" + Replace(Recordset1__MMColParam, "'", "''") + "%' AND
Location LIKE '%" + Replace(Recordset1__MMColParam, "'", "''") + "%' AND
ProjectLead LIKE '%" + Replace(Recordset1__MMColParam, "'", "''") + "%' AND
Status LIKE '%" + Replace(Recordset1__MMColParam, "'", "''") + "%' AND
TypeOfMeeting LIKE '%" + Replace(Recordset1__MMColParam, "'", "''") + "%'ORDER
BY Date_S ASC"
illufox Guest
-
Julian Roberts #4
Re: Search for any column?
Another method might be to concatenate the fields to search. eg
select * from t where f1 & f2 & f3 like '%myParam%'
--
Jules
[url]http://www.charon.co.uk/charoncart[/url]
Charon Cart 3
Shopping Cart Extension for Dreamweaver MX/MX 2004
Julian Roberts Guest
-
bthouin #5
Re: Search for any column?
Yes of course it should be OR and not AND !
But Julian's answer is the brilliant one ! Had no idea one could
concatenate fields !
Bernard
illufox wrote:> Ok, I've done that but now I get no results at all. Shouldn't it be 'OR' insted
> of 'AND'? Here is the updated code:
>
> Recordset1.Source = "SELECT IdMeeting, Date_S, EventName, Location,
> ProjectLead, Status, TypeOfMeeting, MarketingLead, Industry FROM Meeting WHERE
> Industry LIKE '%" + Replace(Recordset1__MMColParam, "'", "''") + "%' AND
> EventName LIKE '%" + Replace(Recordset1__MMColParam, "'", "''") + "%' AND
> Location LIKE '%" + Replace(Recordset1__MMColParam, "'", "''") + "%' AND
> ProjectLead LIKE '%" + Replace(Recordset1__MMColParam, "'", "''") + "%' AND
> Status LIKE '%" + Replace(Recordset1__MMColParam, "'", "''") + "%' AND
> TypeOfMeeting LIKE '%" + Replace(Recordset1__MMColParam, "'", "''") + "%'ORDER
> BY Date_S ASC"
>bthouin Guest



Reply With Quote

