problem with sendAndLoad

  • derekzxx
  • Born
  • Born
  • derekzxx
  • Posts: 2

Post 3+ Months Ago

Hi guys, Im current having a very wired sendAndLoad Problem, Im trying to use it to load my aspx and insert rows into MS ACCESS. The problem is, when I try to Insert a row that contains the same values as what are already in the database, It fails, it can only insert the values that is different from what is already in the database.

I tried to use send() it works perfectly.

P.S. I can retrieve the value from the aspx to the flash every time with the sendAndLoad

Guys please help. im stuck!@!!!


below are my codes:

AS2:
Code: [ Select ]
function gotoDrawFrame():Void
{
    var page_togo = start_drawing()
    result_rank = page_togo; // rewrite the draw result var is located in globle_var layer
   
    var my_lv:LoadVars = new LoadVars();
    var result_var:LoadVars = new LoadVars();
    my_lv.gift_id = getGiftId(result_rank);
    my_lv.store_id = getStoreId();
    my_lv.sendAndLoad("/www/admin/add-draw-report.aspx", result_var, "GET");
 
    result_var.onLoad = function(success:Boolean)
    {
        if(success)
        {
            testing = result_var.toString();
           
            gotoAndPlay(page_togo + "_prize");
           
        }
    }
 
}
  1. function gotoDrawFrame():Void
  2. {
  3.     var page_togo = start_drawing()
  4.     result_rank = page_togo; // rewrite the draw result var is located in globle_var layer
  5.    
  6.     var my_lv:LoadVars = new LoadVars();
  7.     var result_var:LoadVars = new LoadVars();
  8.     my_lv.gift_id = getGiftId(result_rank);
  9.     my_lv.store_id = getStoreId();
  10.     my_lv.sendAndLoad("/www/admin/add-draw-report.aspx", result_var, "GET");
  11.  
  12.     result_var.onLoad = function(success:Boolean)
  13.     {
  14.         if(success)
  15.         {
  16.             testing = result_var.toString();
  17.            
  18.             gotoAndPlay(page_togo + "_prize");
  19.            
  20.         }
  21.     }
  22.  
  23. }


ASPX: /www/admin/add-draw-report.aspx

Code: [ Select ]
Sub Page_Load
   
        Dim sql_statement = ""
        Dim sql_statement_update_qty = ""
        Dim store_id = Request.QueryString("store_id")
        Dim gift_id = Request.QueryString("gift_id")
       
        Dim rightNow As DateTime = DateTime.Now
   
        Dim draw_time = rightNow.ToString("dd/MM/yyyy HH:m:s")
 
        sql_statement = "insert into Ld_Draw_Report (store_id, gift_id, draw_time) Values ("
        sql_statement &= store_id & ","
        sql_statement &= gift_id & ","
        sql_statement &= "'" & draw_time & "'"
        sql_statement &= ")"
       
        'update gift_qty
        sql_statement_update_qty = "update Ld_Store_Gift Set "
        sql_statement_update_qty &= "gift_qty = gift_qty - 1 "
        sql_statement_update_qty &= "where gift_id = " & gift_id
       
       
        Dim something_sql = "select COUNT(draw_report_id) from Ld_Draw_Report"
       
        Dim cnn = accessConnectionOpen()
       
        Dim somethingCommand =  New OleDbCommand(something_sql, cnn)
        Dim myCommand = New OleDbCommand(sql_statement, cnn)
        Dim myCommand_update = New OleDbCommand(sql_statement_update_qty, cnn)
 
        cnn.open()
 
        myCommand.ExecuteNonQuery()
        myCommand_update.ExecuteNonQuery()
        'Commit the transaction.
        'transaction.Commit()
 
        cnn.close()
       
        cnn.open()
        Dim something = somethingCommand.ExecuteScalar()
        cnn.close()
       
               
        Response.Write(something)
       
       
    End Sub
  1. Sub Page_Load
  2.    
  3.         Dim sql_statement = ""
  4.         Dim sql_statement_update_qty = ""
  5.         Dim store_id = Request.QueryString("store_id")
  6.         Dim gift_id = Request.QueryString("gift_id")
  7.        
  8.         Dim rightNow As DateTime = DateTime.Now
  9.    
  10.         Dim draw_time = rightNow.ToString("dd/MM/yyyy HH:m:s")
  11.  
  12.         sql_statement = "insert into Ld_Draw_Report (store_id, gift_id, draw_time) Values ("
  13.         sql_statement &= store_id & ","
  14.         sql_statement &= gift_id & ","
  15.         sql_statement &= "'" & draw_time & "'"
  16.         sql_statement &= ")"
  17.        
  18.         'update gift_qty
  19.         sql_statement_update_qty = "update Ld_Store_Gift Set "
  20.         sql_statement_update_qty &= "gift_qty = gift_qty - 1 "
  21.         sql_statement_update_qty &= "where gift_id = " & gift_id
  22.        
  23.        
  24.         Dim something_sql = "select COUNT(draw_report_id) from Ld_Draw_Report"
  25.        
  26.         Dim cnn = accessConnectionOpen()
  27.        
  28.         Dim somethingCommand =  New OleDbCommand(something_sql, cnn)
  29.         Dim myCommand = New OleDbCommand(sql_statement, cnn)
  30.         Dim myCommand_update = New OleDbCommand(sql_statement_update_qty, cnn)
  31.  
  32.         cnn.open()
  33.  
  34.         myCommand.ExecuteNonQuery()
  35.         myCommand_update.ExecuteNonQuery()
  36.         'Commit the transaction.
  37.         'transaction.Commit()
  38.  
  39.         cnn.close()
  40.        
  41.         cnn.open()
  42.         Dim something = somethingCommand.ExecuteScalar()
  43.         cnn.close()
  44.        
  45.                
  46.         Response.Write(something)
  47.        
  48.        
  49.     End Sub
Moderator Remark: Added code tags.
  • derekzxx
  • Born
  • Born
  • derekzxx
  • Posts: 2

Post 3+ Months Ago

MAN!!!, I fixed it, while writing the POST it opened my mind LOL,

I have added an extra var to my_lv

var report_count = 0;

report_count = report_count + 1
my_lv.count_report_draw = report_count;

this way I will may the var in my_lv different each time it calls.

THANKS GUYS, could any not tell me why it sendAndLoad does not run property when It trys to send the same var?
  • graphixboy
  • Control + Z
  • Mastermind
  • User avatar
  • Posts: 1828
  • Loc: In the Great White North

Post 3+ Months Ago

Its funny how that works. Sometimes you just have to try the perspective of "what would someone else need to know to help me fix this..."

Glad you got it working.

Post Information

  • Total Posts in this topic: 3 posts
  • Users browsing this forum: No registered users and 10 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.