Results 1 to 4 of 4

Thread: Going crazy over this

  1. #1
    Join Date
    Jan 2004
    Posts
    9

    Going crazy over this

    Hi, I'm going crazy from this flash form that SendAndLoad() posts to and asp page then in the same movie a text box gets the asp values. I have an uncommented sql in the asp code below with all other things commented the whole process works fine except the checkboxes selected to begin the whole dynamic data exchange are useless cause they are not use in the retreival of records (I hope you understand so far!). If I comment the sql that I was talking about link this --> 'sql = "SELECT * FROM logbook WHERE cusine IN ('CHINESE')" and I uncomment the array and its respective sql and run the dynamic data process from the start nothing is displayed in the text box. SO i ran the checkbox sripts that sendAndLoad with a geturl in it and pointed the getUrl to the asp page, so the movie would switch to the asp page so i can see the errors. The weird thing is i response wrote the array and all items where there, I response wrote the sql and it was in proper format, everything checks out but nothing is in the text box back on the movie, and trust me i waited for quite some time hoping. Its like the flash movie is reading the asp code and doen't like a dynamically formatted sql? :?: The ASP checks out and the whole flash to asp and back to flash dynamic process work only with a non-dynamic sql. Any ideas?

    ASP code:

    Code:
    arrCuisines = array("AFRICAN","CARIBBEAN","CHINESE","CONTINENTAL","DUTCH",......")
     
     For each cuisine In arrCuisines
       If Request.Form(cuisine) = "true" Then
         strInList = strInList & "'" & cuisine & "',"
       End If
     Next
    arrCuisines = ""
     strInList = Left(strInList, len(strInList)-1)
     
     Set connDB = Server.CreateObject("ADODB.Connection")
    connDB.Open "DBQ=" & Server.MapPath("\fpdb\db.mdb") & ";" & _
    "DRIVER=Microsoft Access Driver (*.mdb)"
    
    sql = "SELECT * FROM logbook WHERE cusine IN (" & strInList & ")"
    // i could select the chinese chechbox and response.write the 
    //sql and i would get exactly the same sql as is commented below 
    //and no data in the text box but if i comment the 
    //dynamic sql and uncomment the below sql below i get the 
    //info in the text box, another words all works fine.
    
    'sql = "SELECT * FROM logbook WHERE cusine IN ('CHINESE')"
     
    Set rs = connDB.Execute(sql)
    
    Do While Not rs.EOF
       Ername=rs("rname") 
       Eeat=rs("eat") 
       
       collect =collect & Ername&","
       collects =collects & Eeat&","
    
    rs.MoveNext
       Loop
    
    output="&output="& collect
       Response.Write output
       Response.Write "end&"
       eoutput="eoutput="& collects
       Response.Write eoutput
       Response.Write "end&"
       Counter = 1
       Response.Write "Counter=" & Counter 
       Response.Write "&"
    
    Set rs = Nothing
    Set connDB = Nothing


    Any thoughts on this?

    :cry:

  2. #2
    Join Date
    Jan 2004
    Posts
    9
    Maybe the array/loop that produces the dynamic sql does not do as i thought it did. If I response.write each checkbox_name on the asp page after the values are sent the asp, it will display true (if it had been checked) or false. I thought the asp array/loop goes thru each value sent from flash and forms a sql of the values that are true only. Am I missing something here?

  3. #3
    Join Date
    Jan 2004
    Posts
    9
    Well after working on this all day i came to teh conclusion that the asp is of proper syntax, and that the flash movie constantly checks for the asp values and this may be screwing things up cause asp repeating the query returns the familiar 'Left' error for this line of code strInList = Left(strInList, len(strInList)-1)
    even though the code if fine when it is ran once. So flash is screwing things up by constantly sending the values to the array until it gets something in return, so i'm wondering if there is a way
    to have the array and this script run only once?

    For each cuisine In arrCuisines
    If Request.Form(cuisine) = "true" Then
    strInList = strInList & "'" & cuisine & "',"
    End If
    Next

    can this be accomplished?

  4. #4
    awasson's Avatar
    awasson is offline Administrator...... of what, were not quite sure.
    Join Date
    Feb 2002
    Location
    Vancouver BC Canada
    Posts
    1,018
    Hi,

    I came to the same conclusion. (without seeing the flash I wasn't sure) I quickly scripted up a page with radio buttons (HTML) and fed it to the For-Each code and then Response.Write(ed) my results. It works every time.

    What you might try is a conditional that prevents all code from running unless it has some input.

    You could try:

    Code:
    If NOT Request.ServerVariables("REQUEST_METHOD")="POST" Then
    
    'Run your Code
    
    End If

    Or if that doesn't work...
    Something like:
    Code:
    For each cuisine In arrCuisines
       If Request.Form(cuisine) = "true" Then
         strInList = strInList & "'" & cuisine & "',"
       End If
    Next
    
    'CHECK FOR INPUT
    If NOT strInList = "" Then
    
        strInList = Left(strInList, len(strInList)-1)
    
        Set connDB = Server.CreateObject("ADODB.Connection")
        connDB.Open "DBQ=" & Server.MapPath("\fpdb\db.mdb") & ";" & _
    "DRIVER=Microsoft Access Driver (*.mdb)"
    
        sql = "SELECT * FROM logbook WHERE cusine IN (" & strInList & ")"
    
         Set rs = connDB.Execute(sql)
    
        Do While Not rs.EOF
            Ername=rs("rname") 
            Eeat=rs("eat") 
       
           collect =collect & Ername&","
           collects =collects & Eeat&","
    
           rs.MoveNext
        Loop
    
        output="&output="& collect
        Response.Write output
        Response.Write "end&"
        eoutput="eoutput="& collects
        Response.Write eoutput
        Response.Write "end&"
        Counter = 1
        Response.Write "Counter=" & Counter 
        Response.Write "&"
    
        Set rs = Nothing
        Set connDB = Nothing 
    
    
    End If
    Gotta go... Good luck!

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •