Ultrashock Forums > Flash > Flex
Cf and SQL - getting Data

You are currently viewing our website as a guest which gives you limited access to forums, files and other resources.

Click here to join now for free, and start interacting with our members, download files and much more!

Click here if you are looking for our Flash files and other professional assets.
 
Post Reply | View first unread | Rate Thread Search this Thread | Thread Tools | Display Modes

#1
Bookmark and Share!
Cf and SQL - getting Data
Old 2008-08-18

Hi all,
I'm connected to SQL DB in flex and I see the table in RDS Dataview, but when I try to retrieve the data thru cfc it doesn't show any. I checked for the data on server it is there. I don't know wht I'm doing wrong and help is appreciated.

"test.cfc"

Code:
<cfcomponent displayname="test.cfc" hint="CFC controls all things in testReport" output="false">
	 <cffunction name="getBuyType" access="remote" returnType="query" output="false">
       <cfquery name="BuyTypeQRY" datasource="gmpwMaster">
   			SELECT DISTINCT Buy_Type
			FROM dbo.perseus_AdAssignment
			WHERE Buy_Type = 'Branding'
			OR Buy_Type = 'InMarket'
			ORDER BY Buy_Type
       </cfquery>
       <cfreturn BuyTypeQRY>
   </cffunction>
</cfcomponent>
Code:
<?xml version="1.0" encoding="utf-8"?>
<mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml" x="0" y="0" width="1200" height="766" creationComplete="initGap()">
	<mx:Script>
	<![CDATA[
			import mx.effects.Resize; 
			import mx.utils.ObjectUtil;
			import mx.controls.Alert;
			import mx.collections.ArrayCollection;
			import mx.rpc.events.ResultEvent;
			import mx.rpc.events.FaultEvent;
			import mx.controls.dataGridClasses.DataGridColumn;
			import mx.core.*; 
			import mx.managers.PopUpManager;
			import mx.containers.TitleWindow;
			import mx.core.IUIComponent;
		    use namespace mx_internal;
			
			[Bindable] public var xmlBuyType:XML;
			[Bindable] public var xmlDivision:XML;
				
			private function initGap():void {
				cfGap.getBuyType(); 
				cfGap.getDivision();			
			}
			
			private function saveGap():void {
				var BuyType:String; 
				var Division:String;
				
				if( cbBuyType.selectedItem.toString()=='' || cbDivision.selectedItem.toString()==''){
					Alert.show("Buy Type Unvalid Type")
				}
				else {
					BuyType = cbBuyType.selectedItem.toString();
					Division = cbDivision.selectedItem.toString();
				}
			}
			public function resultBuyType(event:ResultEvent):void {
					xmlBuyType = new XML(event.result);
			}
			public function resultDivision(event:ResultEvent):void {
					xmlDivision = new XML(event.result);
			}
		]]>
	</mx:Script>
	<!--Database Server Connection -->
	<mx:RemoteObject id="cfGap" destination="ColdFusion" source="TDB.CFCs.test" showBusyCursor="true">
        <mx:method name="getBuyType" result="resultBuyType(event)" fault="Alert.show(event.fault.message)"/>

</mx:Canvas>
postbit arrow 1 comment | 591 views postbit arrow Reply: with Quote   
Registered User
JJSAM is offline
seperator
Posts: 16
2008-08-01
JJSAM lives in United States
seperator

Ultrashock Member Comments:
JJSAM JJSAM is offline JJSAM lives in United States 2008-08-19 #2 Old  
got it to work. thanx.
Reply With Quote  
Thread Tools
Display Modes Rate This Thread
Rate This Thread: