PDA

View Full Version : Simple Flash ASP Search


nutype
08-04-2004, 02:36 AM
Ok I know I'm probably missing something very simple but I need help!

Basically I'm trying to get this search function to work with my flash. When you type a value in flash and the asp outputs the results. Flash then pulls the results and displays them. This just has to work with duplicate results (such as 2 ppl with the same last name).

I can get the search function to work however it only pulls one record not all matching ones.

Sorry if I sound like a muppet, I'm a bit green to ASP. Please help!


Code:

<%@Language="VBScript"%>

<%
Dim employees
Dim oConn




Set employees = Server.CreateObject("ADODB.Recordset")
Set oConn = Server.CreateObject("ADODB.Connection")

oConn.ConnectionString = "AllAsText=0;ApplicationUsingThreads=1;Driver=FileM aker Pro;FetchChunkSize=100;FileOpenCache=0;IntlSort=0; MaxTextlength=255;ServerAddress=127.0.0.1;Translat ionOption=0;UseRemoteConnection=1" & Server.MapPath("employees.fp5")
oConn.Open

employees.Open "SELECT * FROM Employees", oConn, 2, 3
employees.Find "NameLast = '" & UCase(Request.QueryString("strSearch")) & "'"





If employees.EOF Then
Response.Write "NameLast=Not+Found&NameFirst=Not+Found&Position=Not+Found"
Else
Response.Write "NameFirst=" & Server.URLEncode(employees("NameFirst")) & "&NameLast=" & Server.URLEncode(employees("NameLast")) & "&Position=" & Server.URLEncode(employees("Position"))
End If




employees.Close
Set employees = Nothing

oConn.Close
Set oConn = Nothing
%>

nutype
08-05-2004, 12:12 AM
I was able to fix my problem with a little bit of recoding (and help from some friends). Had to change my SQL statement land put in a different loop.





Dim employees, oConn, lname, sqlString

lname = request.QueryString("strSearch")

sqlString = "SELECT * FROM Employees where NameLast = '" & lname & "'"

Set employees = Server.CreateObject("ADODB.Recordset")

Set oConn = Server.CreateObject("ADODB.Connection")

oConn.ConnectionString = "AllAsText=0;ApplicationUsingThreads=1;Driver=FileM aker Pro;FetchChunkSize=100;FileOpenCache=0;IntlSort=0; MaxTextlength=255;ServerAddress=127.0.0.1;Translat ionOption=0;UseRemoteConnection=1" & Server.MapPath("employees.fp5")

oConn.Open

employees.Open sqlString, oConn, 2, 3

If employees.EOF then

Response.Write "NameLast=Not+Found&NameFirst=Not+Found&Position=Not+Found"

Else



while not (employees.eof)

Response.Write "&NameFirst=" & Server.URLEncode(employees("NameFirst")) & "&NameLast=" & Server.URLEncode(employees("NameLast")) & "&Position=" & Server.URLEncode(employees("Position"))



employees.movenext

wend

End If



My next question is that I am able to display the results in a dynamic text field in flash (which is good if all they want to do is look at the results). However, I need the results to be clickable and unique. So if theres 2 smiths that show up in the results, the user can select the correct smith and the information specific to that record shows up.

Anyone have any ideas or can point me in the right direction?

jsam
08-11-2004, 11:19 AM
[QUOTE]My next question is that I am able to display the results in a dynamic text field in flash (which is good if all they want to do is look at the results). However, I need the results to be clickable and unique. So if theres 2 smiths that show up in the results, the user can select the correct smith and the information specific to that record shows up.

Anyone have any ideas or can point me in the right direction?[/[/QUOT>

Hi,

My suggesttion is ,
u may place invisible buttons over the dyna TFs , so that the users can select the name they required. If u r creating a TFs at run time , attach the invisible btns on the TFs. I hope this will help u.

Ok.

What is the DBase u r using?.
Can u Pls explain the following line of code that u wrote..
oConn.ConnectionString = "AllAsText=0;ApplicationUsingThreads=1;Driver=FileM aker Pro;FetchChunkSize=100;FileOpenCache=0;IntlSort=0; MaxTextlengthMaxTextlength=255;ServerAddress=127.0 .0.1;TranslationOption=0;UseRemoteConnection=1" & Server.MapPath("employees.fp5")

Is ur database is Foxpro5?.( I guess so)

JSam.