Aways the simple things changed Response.Write trim(objRS.Fields ("LOC")) & chr(13)
to Response.Write objRS.Fields("LOC") & vbcrlf And it worked fine :-) On 4/23/07, James Trix <[EMAIL PROTECTED]> wrote:
Well I ported the search code to asp as the server is windows based and also now also use SQL to hold the data as per the ideas from last week but I have a problem. I can run search.asp?q=ABC or search.php?q=ABC and both will output what appears to be the same even down to the byte count. but when I make a change in the HTML file so it uses the asp version of the search code it will only ever returns 1 record. But yet when I run search.asp?q=ABC it will out put XX amount records just like the php version. Here is the ASP code. <% Dim ServerName Dim DBName Dim DBUserName Dim DBPassword Dim lConnectionobj Dim lconnectionString Dim Q Q = Request.QueryString("q") ServerName = "server" DBName = "database" DBUserName = "user" DBPassword = "password" if Q = "" then response.write "No QueryString Found" response.end end if Set lConnectionobj = Server.CreateObject("ADODB.Connection") lconnectionString = "Provider=SQLOLEDB;Data Source=" & ServerName & ";User ID= " & DBUserName & _ ";Password= " & DBPassword & ";persist security info=False;Initial Catalog= " & DBName lConnectionobj.open lconnectionString Dim SQLString SQLString = "SELECT LOC + '|' as LOC FROM Suburbs WHERE LOC LIKE '%" & q & "%'" DIM objRS Set objRS = Server.CreateObject("ADODB.Recordset") objRS.Open SQLString, lConnectionobj,adOpenDynamic while not objRS.EOF Response.Write trim(objRS.Fields ("LOC")) & chr(13) objRS.Movenext wend lConnectionobj.close %> Here is the output from search.php Chinatown NSW 2000| Church Hill NSW 2000| Circular Quay NSW 2000| Here is the output from search.asp Chinatown NSW 2000| Church Hill NSW 2000| Circular Quay NSW 2000| Here is the copy of the php code where I had entered all the towns in an array (I have not listed all 30k of them) <?php $q = strtolower($_GET["q"]); if (!$q) return; $items = array( "Chinatown NSW 2000", "Church Hill NSW 2000", "Circular Quay NSW 2000" ); foreach ($items as $value) { if (strpos(strtolower($value), $q) !== false) { echo "$value|\n"; } } ?> The html I was changing was $("#suggest2").autocomplete("search.php", { to $("#suggest2").autocomplete("search.asp", { Any ideas why when I use a ASP version of the search back end it will only return 1 record (doing a http sniff shows that it is returning all of the records but for some reason the javascript only displays 1 record) Regards James