flex調(diào)用webservice中的自定義類(lèi)的方法
public class ReturnResult
{
public int curIndex { get; set; }
public DataTable idxList { get; set; }
}
//測(cè)試數(shù)據(jù)庫(kù)連接
[WebMethod(Description = "?。?!測(cè)試數(shù)據(jù)庫(kù)連接,鏈接字符串在web.config中")]
public bool conectDB()
{
strCon = ConfigurationSettings.AppSettings["sqlConDuke"];
conn = new SqlConnection(strCon);
try
{
conn.Open();
return true;
}
catch (Exception)
{
return false;
}
finally
{
conn.Close();
}
}
[WebMethod(Description = "根據(jù) 照片名 獲得詳細(xì)數(shù)據(jù)(DataTable),strTb,eg:PanView;strImgName,eg:20131019072740-0000150")]
public DataTable getInfoByImgName(string strTb, string strImgName)
{
bool ifCon = conectDB();
if (ifCon)
{
string sql_BfCar = "SELECT * FROM dbo." + strTb + " where ImageName LIKE '%" + strImgName + "%'";
da = new SqlDataAdapter(sql_BfCar, conn);
myds = new DataSet();
da.Fill(myds);
return myds.Tables[0];
}
else
{
return null;
}
}
[WebMethod(Description = "根據(jù) 照片名 獲得所在Link的所有數(shù)據(jù)(ReturnResult),strTb,eg:PanView;strImgName,eg:20131019072740-0000150")]
public ReturnResult getLinkDTByImgName(string strTb, string strImgName)
{
ReturnResult returnResult = new ReturnResult();
bool ifCon = conectDB();
if (ifCon)
{
returnResult.curIndex = Convert.ToInt32(getInfoByImgName(strTb, strImgName).Rows[0][0]);
string strLinkGuid = getInfoByImgName(strTb, strImgName).Rows[0][1].ToString();
string sql_BfCar = "SELECT * FROM dbo." + strTb + " where LinkGuid LIKE '%" + strLinkGuid + "%'";
da = new SqlDataAdapter(sql_BfCar, conn);
myds = new DataSet();
da.Fill(myds);
returnResult.idxList = myds.Tables[0];
return returnResult;
}
else
{
return null;
}
}
Flex代碼:
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600" creationComplete="application1_creationCompleteHandler(event)">
<fx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
import mx.controls.Alert;
import mx.events.FlexEvent;
import mx.rpc.events.FaultEvent;
import mx.rpc.events.ResultEvent;
public var arr:ArrayCollection=new ArrayCollection();
public var aaa:String=new String();
protected function webservice1_faultHandler(event:FaultEvent):void
{
Alert.show(event.fault.toString());
}
protected function getLinkDTByImgNameHandler(event:ResultEvent):void
{
// aaa=this.myweb.getLinkDTByImgName.lastResult.curIndex;
// arr=this.myweb.getLinkDTByImgName.lastResult.idxList.Tables.Table.Rows;
aaa=event.result.curIndex;
arr=event.result.idxList.Tables.Table.Rows;
Alert.show(aaa+" "+arr.length.toString());
}
protected function application1_creationCompleteHandler(event:FlexEvent):void
{
myweb.getLinkDTByImgName("PanView","20131019072740-0000150");
}
]]>
</fx:Script>
<fx:Declarations>
<!-- 將非可視元素(例如服務(wù)、值對(duì)象)放在此處 -->
<s:WebService id="myweb" wsdl="http://10.19.1.55/serverPano/WebServiceDuke.asmx?WSDL" fault="webservice1_faultHandler(event)">
<s:operation name="getLinkDTByImgName" result="getLinkDTByImgNameHandler(event)"></s:operation>
</s:WebService>
</fx:Declarations>
</s:Application>
上一篇:datagrid不可編輯行有關(guān)問(wèn)題的控制方法
欄 目:Flex
下一篇:沒(méi)有了
本文標(biāo)題:flex調(diào)用webservice中的自定義類(lèi)的方法
本文地址:http://mengdiqiu.com.cn/a1/Flex/11604.html
您可能感興趣的文章
- 01-11Flex實(shí)現(xiàn)的上傳攝像頭拍照并將UI保存為圖片
- 01-11Flex字體加粗問(wèn)題只能對(duì)英文的字體加粗
- 01-11flex利用webservice上傳照片實(shí)現(xiàn)代碼
- 01-11Flex控制彈出窗口拖動(dòng)范圍示例代碼
- 01-11flex內(nèi)嵌html網(wǎng)頁(yè)示例代碼
- 01-11Flex中在Tree綁定數(shù)據(jù)后自動(dòng)展開(kāi)樹(shù)節(jié)點(diǎn)的方法
- 01-11Flex彈出窗口請(qǐng)求Action函數(shù)示例
- 01-11Flex中通過(guò)RadioButton進(jìn)行切換示例代碼
- 01-11Flex中TabNavigator設(shè)置Tabs樣式思路及源碼
- 01-11Flex打開(kāi)新窗口將主窗口數(shù)據(jù)傳給子窗口然后返回


閱讀排行
- 1C語(yǔ)言 while語(yǔ)句的用法詳解
- 2java 實(shí)現(xiàn)簡(jiǎn)單圣誕樹(shù)的示例代碼(圣誕
- 3利用C語(yǔ)言實(shí)現(xiàn)“百馬百擔(dān)”問(wèn)題方法
- 4C語(yǔ)言中計(jì)算正弦的相關(guān)函數(shù)總結(jié)
- 5c語(yǔ)言計(jì)算三角形面積代碼
- 6什么是 WSH(腳本宿主)的詳細(xì)解釋
- 7C++ 中隨機(jī)函數(shù)random函數(shù)的使用方法
- 8正則表達(dá)式匹配各種特殊字符
- 9C語(yǔ)言十進(jìn)制轉(zhuǎn)二進(jìn)制代碼實(shí)例
- 10C語(yǔ)言查找數(shù)組里數(shù)字重復(fù)次數(shù)的方法
本欄相關(guān)
- 01-11flex調(diào)用webservice中的自定義類(lèi)的方法
- 01-11Flex實(shí)現(xiàn)的上傳攝像頭拍照并將UI保存
- 01-11datagrid不可編輯行有關(guān)問(wèn)題的控制方法
- 01-11Flex控制彈出窗口拖動(dòng)范圍示例代碼
- 01-11flex利用webservice上傳照片實(shí)現(xiàn)代碼
- 01-11Flex字體加粗問(wèn)題只能對(duì)英文的字體加
- 01-11Flex中在Tree綁定數(shù)據(jù)后自動(dòng)展開(kāi)樹(shù)節(jié)點(diǎn)
- 01-11flex內(nèi)嵌html網(wǎng)頁(yè)示例代碼
- 01-11Flex中通過(guò)RadioButton進(jìn)行切換示例代碼
- 01-11Flex彈出窗口請(qǐng)求Action函數(shù)示例
隨機(jī)閱讀
- 01-11Mac OSX 打開(kāi)原生自帶讀寫(xiě)NTFS功能(圖文
- 08-05織夢(mèng)dedecms什么時(shí)候用欄目交叉功能?
- 01-10C#中split用法實(shí)例總結(jié)
- 01-10delphi制作wav文件的方法
- 08-05dedecms(織夢(mèng))副欄目數(shù)量限制代碼修改
- 01-10SublimeText編譯C開(kāi)發(fā)環(huán)境設(shè)置
- 08-05DEDE織夢(mèng)data目錄下的sessions文件夾有什
- 01-10使用C語(yǔ)言求解撲克牌的順子及n個(gè)骰子
- 01-11ajax實(shí)現(xiàn)頁(yè)面的局部加載
- 04-02jquery與jsp,用jquery