luigicannavaro
11-07-2008, 12:40 PM
Dear friends,
I have the following ASP script to display selected data. Well, but I would like to display selected data within parameters:
I want to show only 100 characters before and 100 characters after the filter keyword or keywords from a memofield (named contents). Taking into account the boundaries of that 100 characters. 'Contents' is a memofield.
My ASP script:
____________
<html>
<body>
<%
set conn=Server.CreateObject("ADODB.Connection")
conn.Provider="Microsoft.Jet.OLEDB.4.0"
conn.Open "c:/webdata/northwind.mdb"
Dim strkeyword
Strkeyword= Request.Querystring("look_for")
set rs=Server.CreateObject("ADODB.recordset")
sql="SELECT contents FROM Customers
WHERE CompanyName LIKE '"" %Strkeyword% "' "
rs.Open sql, conn
%>
' contents it is a memofield
<table border="1" width="100%">
<tr>
<%for each x in rs.Fields
response.write " 100 characters before strkeyword "
response.write strkeyword
response.write " 100 characters after strkeyword "
next%>
</tr>
<%do until rs.EOF%>
<tr>
<%for each x in rs.Fields%>
<td><%Response.Write(x.value)%></td>
<%next
rs.MoveNext%>
</tr>
<%loop
rs.close
conn.close%>
</table>
</body>
</html>
_____________________________________________
Thank you so much
Luigi
______
______
I have the following ASP script to display selected data. Well, but I would like to display selected data within parameters:
I want to show only 100 characters before and 100 characters after the filter keyword or keywords from a memofield (named contents). Taking into account the boundaries of that 100 characters. 'Contents' is a memofield.
My ASP script:
____________
<html>
<body>
<%
set conn=Server.CreateObject("ADODB.Connection")
conn.Provider="Microsoft.Jet.OLEDB.4.0"
conn.Open "c:/webdata/northwind.mdb"
Dim strkeyword
Strkeyword= Request.Querystring("look_for")
set rs=Server.CreateObject("ADODB.recordset")
sql="SELECT contents FROM Customers
WHERE CompanyName LIKE '"" %Strkeyword% "' "
rs.Open sql, conn
%>
' contents it is a memofield
<table border="1" width="100%">
<tr>
<%for each x in rs.Fields
response.write " 100 characters before strkeyword "
response.write strkeyword
response.write " 100 characters after strkeyword "
next%>
</tr>
<%do until rs.EOF%>
<tr>
<%for each x in rs.Fields%>
<td><%Response.Write(x.value)%></td>
<%next
rs.MoveNext%>
</tr>
<%loop
rs.close
conn.close%>
</table>
</body>
</html>
_____________________________________________
Thank you so much
Luigi
______
______