Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
malhyp
Starting Member
21 Posts |
Posted - 2005-12-10 : 06:18:23
|
| Can anyone suggest whey I dont get any results with this search?SQL reads:SELECT SupplierName, Location, ShortDescriptionFROM Query1WHERE 'TimberSpecies' LIKE '%MMColParam%' AND 'CategoryTable' LIKE '%MMColParam2%' AND 'Location' LIKE '%MMColParam3%'MMColParam 1 Request.Form("keywordSearch")MMColParam2 2 Request.Form("location")MMColParam3 3 Request.Form("category") Mally. |
|
|
chiragkhabaria
Master Smack Fu Yak Hacker
1907 Posts |
Posted - 2005-12-10 : 06:33:19
|
| you need to write the stored procedure.. where u have to pass this 3 paramters.. somthing like this .. Create proc searchdesc(@pCol1 varchar(200),@pCol2 varchar(200),@pCol3 varchar(200))As Begin SELECT SupplierName, Location, ShortDescriptionFROM Query1WHERE TimberSpecies LIKE '%' +@pCol1 + '%' AND CategoryTable LIKE '%' +@pCol2 + '%'AND Location LIKE '%' +@pCol3 + '%'End ??is this u r looking for .. or post the sample data..???Sucess Comes to those who Believe in Beauty of their Dream.. |
 |
|
|
afrika
Master Smack Fu Yak Hacker
2706 Posts |
Posted - 2005-12-10 : 15:18:59
|
looks like dreamweaver you are usingyour asp variable should beMMColParam1 = Request.Form("keywordSearch")or as dreamweaver puts itsif MMColParam1 = "1"if MMColParam1 <> "" then MMColParam1 = request.form("KeywordSearch")It also seems to me that you are using a recordset ???lets see some sample code |
 |
|
|
malhyp
Starting Member
21 Posts |
Posted - 2005-12-10 : 18:39:30
|
| I hope this is the data required. Let me know if I need to post more.<!--#include file="connTimber.asp" --><%Dim rsSearchResult__MMColParam1rsSearchResult__MMColParam1 = "%"If (Request.Form("keywordSearch") <> "") Then rsSearchResult__MMColParam1 = Request.Form("keywordSearch") End If%><%Dim rsSearchResult__MMColParam2rsSearchResult__MMColParam2 = "%"If (Request.Form("CategoryTable") <> "") Then rsSearchResult__MMColParam2 = Request.Form("CategoryTable") End If%><%Dim rsSearchResult__MMColParam3rsSearchResult__MMColParam3 = "%"If (Request.Form("Location") <> "") Then rsSearchResult__MMColParam3 = Request.Form("Location") End If%><%Dim rsSearchResultDim rsSearchResult_numRowsSet rsSearchResult = Server.CreateObject("ADODB.Recordset")rsSearchResult.ActiveConnection = MM_connTimber_STRINGrsSearchResult.Source = "SELECT SupplierName, Location, ShortDescription FROM Query1 WHERE TimberSpecies LIKE '%" + Replace(rsSearchResult__MMColParam1, "'", "''") + "%' AND 'CategoryTable' LIKE '%" + Replace(rsSearchResult__MMColParam2, "'", "''") + "%' AND 'Location' LIKE '%" + Replace(rsSearchResult__MMColParam3, "'", "''") + "%'"rsSearchResult.CursorType = 0rsSearchResult.CursorLocation = 2rsSearchResult.LockType = 1rsSearchResult.Open()rsSearchResult_numRows = 0%><%Dim Repeat1__numRowsDim Repeat1__indexRepeat1__numRows = 4Repeat1__index = 0rsSearchResult_numRows = rsSearchResult_numRows + Repeat1__numRows%><%' *** Recordset Stats, Move To Record, and Go To Record: declare stats variables' set the record countrsSearchResult_total = rsSearchResult.RecordCount' set the number of rows displayed on this pageIf (rsSearchResult_numRows < 0) Then rsSearchResult_numRows = rsSearchResult_totalElseif (rsSearchResult_numRows = 0) Then rsSearchResult_numRows = 1End If' set the first and last displayed recordrsSearchResult_first = 1rsSearchResult_last = rsSearchResult_first + rsSearchResult_numRows - 1' if we have the correct record count, check the other statsIf (rsSearchResult_total <> -1) Then If (rsSearchResult_first > rsSearchResult_total) Then rsSearchResult_first = rsSearchResult_total If (rsSearchResult_last > rsSearchResult_total) Then rsSearchResult_last = rsSearchResult_total If (rsSearchResult_numRows > rsSearchResult_total) Then rsSearchResult_numRows = rsSearchResult_totalEnd If%> |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-12-12 : 01:29:30
|
| Did you get any error message?Did you get unexpected result?MadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|
|
|