A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: experts, please help me with loadVars and ASP, Im begging

  1. #1
    Danny Gomez Creations ® cosmiceye's Avatar
    Join Date
    Mar 2002
    Location
    under a palmtree in Jamaica waiting for psytopia 2005 to begin
    Posts
    982
    I am trying to learn serverside scripting, and I have gone trough several tutorials and examples. But I cant find 1 that just simply tells me how to write to the the damn asp or database. I have a huge webbspace on my university server, but they dont allow php (freakin lamers), so its up to asp and access database. Is there someone capeble of describing to me a way to pass a value from flash to asp, and from that to a db(if necessary) ? More than happy to use the loadVars object. I could allso go with xml. The only thing I really really need to know to get started is hoew to reed& WRITE to the server.

    Please help me on this journey to knowledge, so I can make an VERY interresting site for you to check,play&criticise.

    /Danny Gomez

    thank you...I have waited more then enought with serverside scripting...I will lay my cosmic eye of healing upon dee who helps me out

  2. #2
    Danny Gomez Creations ® cosmiceye's Avatar
    Join Date
    Mar 2002
    Location
    under a palmtree in Jamaica waiting for psytopia 2005 to begin
    Posts
    982

    yeah, one reply, but its my own

    Come on guys, I know that some of you are real good at this!

  3. #3
    Senior Member
    Join Date
    Apr 2002
    Location
    Hong Kong
    Posts
    171
    Cosmic - so sad having to talk to yourself!

    Send the variable from Flash to asp in the easiest way is through the normal GetURL which will send any variables declared in the current MC using the normal ?var1=value1&var2=value2 string on the URL.
    Your asp file reads those variables using Request("var1") etc.
    You use the ADODB object to talk to any kind of database through asp - the following snippets should get you going to an Access database that you know the path to

    Code:
    <!-- functions for connecting to a recordset -->
    Function GetConnection( Param )
       Dim conn 
    
       On Error Resume Next
       Set GetConnection = Nothing
       Set conn = Server.CreateObject("ADODB.Connection")
       If Err.Number <> 0 Then Exit Function
    
       conn.Open Param
       If Err.Number <> 0 Then Exit Function
       Set GetConnection = conn
    End Function
    
    Function GetMdbConnection( FileName )
       Dim Provider, DBPath
    
       Provider = "Provider=Microsoft.Jet.OLEDB.4.0;"
       DBPath = "Data Source=" & Server.MapPath(FileName)
       Set GetMdbConnection = GetConnection( Provider & DBPath )
    End Function
    
    Function GetMdbRs( FileName, Source, Cursor, Password )
       Dim conn, rs
    
       On Error Resume Next
       Set GetMdbRs = Nothing
       If Len(Password) = 0 Then
           Set conn = GetMdbConnection( FileName )
       End If
       If conn Is Nothing Then Exit Function
    
       Set rs = Server.CreateObject("ADODB.Recordset")
       If Err.Number <> 0 Then Exit Function
    
       rs.Open source, conn, Cursor, 2
       If Err.Number <> 0 Then Exit Function
       Set GetMdbRs = rs
    End Function
    
    Function GetMdbRecordset( FileName, Source )
       Set GetMdbRecordset = GetMdbRs( FileName, Source, 2, "" )
    End Function
    
    <!-- an example of an SQL call to the database based on a variable sent in the URL-->
    
    Sql="Select Level, License, Price From Item Where ItemID=" & "'" & Request("Product") & "'"
    Set Product=GetMdbRecordset("/Data/Products.mdb", sql)
     If Product Is Nothing Then Response.End
     If Not Product.Eof Then
      Product.MoveFirst
      Do While Not Product.Eof
       Select Case Trim(Product("Level"))
        Case "AP"
         If Product("License")=1 Then Price(1,1)=Product("Price")
        End select
       Product.MoveNext
      Loop
     End If
    Hope this helps you get going, it isn't complete but should be a start.

  4. #4
    Danny Gomez Creations ® cosmiceye's Avatar
    Join Date
    Mar 2002
    Location
    under a palmtree in Jamaica waiting for psytopia 2005 to begin
    Posts
    982
    thanks Docker; you are my hero. Im gonna experimant and do some mad things as soon as I get the time for it , and you gonnea like it. Mad props to you for helping me, Im gonna check out your site man , Thank you for your existence! Your the man, dude!!! Thumbs up for DOCKER!!!!

Posting Permissions

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




Click Here to Expand Forum to Full Width

HTML5 Development Center