[Flex] Flex and asp.net data exchange __.net

Source: Internet
Author: User
Flex code: <?xml version= "1.0"  encoding= "Utf-8"?> <mx:application xmlns:mx= "http:// Www.adobe.com/2006/mxml " layout=" absolute "> <mx:webservice wsdl=" http://localhost:2016/Service/ SERVICE.ASMX?WSDL " id=" ws1 "> <mx:operation name=" Sqlcheck " result=" Resulthandler () "  >     <mx:request>         <sql>{ sqlstring.text}</sql>     </mx:request> </mx:operation> </mx:webservice > <mx:webservice wsdl= "http://localhost:2016/Service/Service.asmx?wsdl"  id= "Query" >          <mx:operation name= "Queryliuyan" >                  <mx:request>                          &nbsP;<info>                                  { Nameinput.text,titleinput.text,contentinput.text}                          </info>                  </mx:request>          </mx:operation> </mx:WebService> <mx:Script>      <! [Cdata[        import mx.rpc.events.ResultEvent;              [bindable]              private var asd:XML;              private function resulthandler (): void{                 asd = new xml ( Ws1.sqlcheck.lastResult);                  Datetest.dataprovider = asd.children ();                 title1.text &NBSP;=&NBSP;ASD.. TITLE[1];                 name1.text &NBSP;=&NBSP;ASD.. NAME[1];                 date1.text &NBSP;=&NBSP;ASD.. DATE[1];                 content1.text &NBSP;=&NBSP;ASD.. CONTENT[1];                 &NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP}     ]]> </mx :script>         <mx:datagrid x= " y=" " id=" Datetest ">                  <mx:columns>                          <mx:datagridcolumn headertext= "Theme"   datafield= "title"/>                          <mx:datagridcolumn headertext= "Author"   datafield= "Name"/>                          <mx:datagridcolumn headertext= "Date"   datafield= "Date"/>                          <mx:datagridcolumn headertext= "Contents"  datafield= "Content"/>                  </mx:columns>         </mx:DataGrid>          <mx:label  id= "SqlString"  x= " y=" 428 " text=" select title,name,date, Content from liuyan "/>         <mx:button x=" 466 "  y= " label=" Query " fontsize=" " click=" ws1.sqlcheck.send (); />         <mx:label x= "529"  y= " text=" "Label"  id= "Title1"  fontsize= "/>         <mx:label x=" 529 " y=" 130 " text=" Label "&nbspId= "name1"  fontsize= "/>         <mx:label x=" 529 "  y= "167"  text= "Label"  id= "Date1"  fontsize= ""/>          <mx:label x= "529"  y= "205"  text= "Label"  id= "Content1"  fontsize= "14"/ > </mx:Application>  net Code

using system; using system.web; using system.web.services; using system.web.services.protocols; using system.data.oledb; using system.collections; using system.data; [WebService (namespace =  "http://tempuri.org/")] [WebServiceBinding (Conformsto = wsiprofiles.basicprofile1_1)] public class service :  system.web.services.webservice {    public Service  ()  {         //If you are using a design component, uncomment the following line            InitializeComponent ();     &nbsp}     [webmethod]//displayed directly in the DataGrid     public string sqlscan (string sql)     {         oledbconnection connection = new oledbconnection ();         connection. connectionstring =  "provider=microsoft.jet.oledb.4.0;data source=";         connection. Connectionstring += server.mappath ("User.mdb");         system.data.oledb.oledbdataadapter liuyan = new  oledbdataadapter (sql, connection);         dataset dataset1 = new dataset ("test");         liuyan. Fill (DataSet1);         return dataset1. GETXML (); &NBSP;&NBSP;&NBSP;&NBSP}     [webmethod]//This is the connection database and is displayed in label      Public string sqlcheck (string sql)     {         oledbconnection connection = new oledbconnection ();         connection. connectionstring =  "Provider=microsofT.jet.oledb.4.0;data source= ";         connection. Connectionstring += server.mappath ("User.mdb");         system.data.oledb.oledbdataadapter tempadapter =  new oledbdataadapter (sql, connection);         dataset dataset = new dataset ("temp");         tempadapter.fill (DataSet);         return dataset. GETXML (); &NBSP;&NBSP;&NBSP;&NBSP}}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.