View Full Version : Can not fetch dataset from SQL Server using SqlClient

04-06-2005, 06:28 PM
I am using Flash remoting MX to fetch dataset. Before, I use a Access database to test it and it works just fine. Then I switch to the SQL Server using SqlClient. It becomes no response, no data and no error message. When I replace Flash.DataSource + Flash.DataBind with Flash.Result, actually I can see there is a dataset filled with data. The problem is I can not fetch it even it is there. Am I doing something wrong ?

Any suggestion welcomed.

Here is the key part:

<code in the first frame>

#include "NetServices.as"

if( inited == null )
inited = true;

NetServices.setDefaultGatewayUrl( "http://localhost/campaignmanager/gateway.aspx" );

gatewayConnection = NetServices.createGatewayConnection();

gatewayConnection.setDebugID("Gateway Connection");

mySQLService = gatewayConnection.getService( "campaignmanager/services",this );

function myGetCampaignList( queryString )

mySQLService.getCampaign( queryString );


//callback with result data from ASP.Net service

function getCampaign_Result( result )

campaigns_DS_Results = result;

MessageBox("get the campaigns : Data Fetched");


//callback with status or error message
function getCampaign_Status( error )
MessageBox(error.description );

<getCampaign.aspx :>

<%@ Page Language="C#" debug="true" %>
<%@ Register TagPrefix="MM" Namespace="FlashGateway" Assembly="flashgateway" %>
<%@ import namespace="System.Data" %>
<%@ import namespace="System.Data.SqlClient" %>

<title>jasonmperry.com flash remoting sql query tool</title>
<MM:Flash id="Flash" runat="server" />

<script langauge="C#" runat="server">

void Page_Load( Object sender, EventArgs e)
string queryString = "SELECT * FROM Campaigns";

//get Flash parameters
if( Flash.Params.Count > 0 )
queryString = Flash.Params[0].ToString();

//create database connection
SqlConnection connection;
string ConnectionString = ConfigurationSettings.AppSettings["dbconn"];
connection = new SqlConnection( @ConnectionString );

//query database and creates results
SqlDataAdapter adapter = new SqlDataAdapter( queryString, connection );
DataSet dbData = new DataSet();

//places results into a data set
adapter.Fill( dbData, "Results" );

//Flash.Result = "Count " + dbData.Tables["Results"].Rows[0][1]; // Can return the right data

Flash.DataSource = dbData.Tables["Results"];