ASP.NET + FLASH2004 Learning Notes

xiaoxiao2021-03-06  49

How to bind the data set of the ASP.NET in FlashMX2004:

<% @ Webservice Language = "C #" class = "test"%>

Using system;

Using system.data;

Using system.Web.services;

Using system.data.oledb;

Public Class Test: WebService

{

[WebMethod]

Public Dataset getds ()

{

DataSet DS = New Dataset ();

OLEDBCONNECTION CONN = New OLEDBCONNECTION ("provider = microsoft.jet.Oledb.4.0; data source = d: /service.mdb");

OLEDBDataAdapter Da = New OLEDBDataAdapter ("SELECT TOP 3 ID, NAME, CONTEN"

Cn.open ();

DA.FILL (DS, "Example");

CONN.CLOSE ();

Return DS;

}

}

When debugging, call the getDS method, you can get the following XML file:

>

1 lau hello 2 xiao it's good 3 bb WA ~

Return this Dataset is the [Object Object] type. The data type of Results obtained based on WSDL is .NET Dataset, but this is not included in the data type inherent in the Flash. After a large number of tests finally found two solutions:

Method 1:

SqlConnection conn = new SqlConnection (ConfigurationSettings.AppSettings [ "ConnectionString"]); SqlDataAdapter da = new SqlDataAdapter ( "select * from BBS_ Irrigation Irrigation visiting the park _ _ posts mad", conn); DataSet ds = new DataSet (); CONN.Open (); da.fill (ds); xmldataDocument Xmldoc = New XmlDataDocument (DS);

Return XMLDoc.innerXML // This is the Dataset in XML format

Measures accepted in Flash:

MY_XML = New XML ();

My_XML.PARSE ("Here is the result you get through WebService (the XMLDoc.innerXML)" in my code ")"); then passed the result to flash, my_xml is Dataset in XML format, then you are Give it to DataGrid. OK! Try it.

转载请注明原文地址:https://www.9cbs.com/read-116093.html

New Post(0)