Flash AS2.0与ASP.Net(C#)之间的数据交互
发布时间:2020-12-15 06:28:10 所属栏目:百科 来源:网络整理
导读:flash端的AS var SendVars:LoadVars=new LoadVars(); var ReceiveVars:LoadVars=new LoadVars(); ReceiveVars.onLoad=function(Success:Boolean):Void{ ??? ??? if(Success) ??? ??? { ??? ??? ??? if(ReceiveVars.ok!=undefined) ??? ??? ??? { ??? ??? ???
flash端的AS var SendVars:LoadVars=new LoadVars(); var ReceiveVars:LoadVars=new LoadVars(); ReceiveVars.onLoad=function(Success:Boolean):Void{ ??? ??? if(Success) ??? ??? { ??? ??? ??? if(ReceiveVars.ok!=undefined) ??? ??? ??? { ??? ??? ??? intext.text=""; ??? ??? ??? intxt.text=""; ??? ??? ??? status_lbl.text = "<b>成功发表</b>"; ??? ??? ??? } ??? ??? ??? else ??? ??? ??? getURL("javascript:alert('有错误了啊');"); ??? ??? ??? } ??? ??? else ??? ??? { ??? ??? ??? getURL("javascript:alert('发表失败!');"); ??? ??? } } submit_btn.clickHandler = function() { ??? callSave(); } function callSave() { ??? var url="accesslink.aspx";??? ??? SendVars.nn=escape(intext.text); ??? SendVars.ct=escape(intxt.text); ??? SendVars.op="add"; ??? SendVars.sendAndLoad(url,ReceiveVars,"POST"); ??? wait.gotoAndPlay(1);??? } C#端的接受: OleDbConnection conn = new OleDbConnection(ConfigurationManager.AppSettings["MyJetConn"]); ??????? string SQL = "INSERT INTO message (nicename,content) VALUES (?,?)"; ??????? OleDbCommand cmd = new OleDbCommand(SQL,conn); ??????? cmd.Parameters.Add(new OleDbParameter("@nicename",OleDbType.VarChar,10)); ??????? cmd.Parameters["@nicename"].Value =Server.UrlDecode(Request.Form["nn"].ToString()); ??????? cmd.Parameters.Add(new OleDbParameter("@content",50)); ??????? cmd.Parameters["@content"].Value = Server.UrlDecode(Request.Form["ct"].ToString()); ??????? conn.Open(); ??????? cmd.ExecuteNonQuery(); ??????? conn.Close(); ??????? Response.Write("修改成功!"); web的配置,这里要加的不然乱码,FLASH里面是默认的UTF-8 <system.web> <globalization requestEncoding="utf-8" responseEncoding="utf-8" /> </system.web>
(编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |