I have successfully communication between actionscript and asp.net for a string, but I have difficulty to pass an integer value from asp.net to actionscript.

In my asp.net I have the following function:

<WebMethod(Description:="This method will get the record count from database tables.")> _

Public Function GetCount(ByVal sqlQuery As String) As Integer 
   ' sqlQuery comes from actionscript

    Dim count As Integer

        If Not sqlQuery = Nothing Then
            cmd = New SqlCommand(sqlQuery, conn)
            reader = cmd.ExecuteReader()
            If reader.Read() Then
                count = reader("cnt")
            End If
        End If

    Catch ex As Exception
        Throw New ApplicationException("Error in collecting data from Database. Error is :" & ex.Message)
    End Try

    Return count
End Function

And the function in actionscrpt which pass the sqlQuery and get the count value is:

    var sqlQuery = "SELECT COUNT(*) FROM USERS WHERE AGE > 40";
        var getResultCount:int;
        ws.GetCount(sqlQuery); ' this should be the count value return from asp right? 
        getResultCount = ws.GetCount(sqlQuery); 'I always get error

   public function GetBQCount(event:ResultEvent):void {


<mx:WebService id="ws" wsdl="http://localhost/WebService/Service.asmx?WSDL" fault="fault(event)">

Very newbie for this. Anybody can help me? thanks.

Related posts

Recent Viewed