dcsimg
www.webdeveloper.com
Results 1 to 5 of 5

Thread: queryBean datatype conversion

Hybrid View

  1. #1
    Join Date
    Dec 2004
    Posts
    1

    queryBean datatype conversion

    I am developing an ASP.NET application that will be utilizing several ColdFusion web services. The web services return a datatype of QueryBean.

    The problem is that I cant find the right ASP.Net datatype to return the web service results (QueryBean) to. I've tried string, dataset, xml doc.

    Can someone tell me what datatype I need to use to accept the reults of the ColdFusion web service?


    Thanks.

  2. #2
    Join Date
    Jul 2006
    Location
    Istanbul
    Posts
    4

    Thumbs up Coldfusion Web Service QueryBean Conversion

    Hi,
    Unfortunately there isn't any direct solution to accomplish this issue. But I written Visual Basic code in my asp.net project then I could use querybean data which return from CFC service.how??

    That's it:

    Imports System.Data


    Partial Class test
    Inherits System.Web.UI.Page



    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    Dim srv As New tr.com.domain.www.Service
    Dim qbean As tr.com.domain.www.QueryBean
    qbean = srv.iller 'returns city names and their ids in querybean
    Dim dtable As New DataTable
    dtable = maketable(qbean.columnList)
    Dim odata As Object
    Dim row As DataRow = Nothing
    Dim icount As Integer = 0

    Dim i As Integer
    For i = 0 To qbean.data.Length - 1
    odata = qbean.data(i)
    row = dtable.NewRow


    For Each oloopdata As Object In odata
    row(icount) = oloopdata
    icount = icount + 1

    Next
    icount = 0
    dtable.Rows.Add(row)
    Next

    DropDownList1.DataSource = dtable
    DropDownList1.DataTextField = "AD"
    DropDownList1.DataValueField = "IL_ID"
    DropDownList1.DataBind()

    End Sub

    Public Function maketable(ByVal scolumns() As String) As DataTable
    Dim dtable As DataTable
    dtable = New DataTable("dtable")
    Dim dcolumn As DataColumn
    Dim columnname As String

    For Each columnname In scolumns
    dcolumn = New DataColumn(columnname, Type.GetType("System.String"))
    dtable.Columns.Add(dcolumn)
    Next
    Return dtable
    End Function

    End Class



    Happy coding.....

  3. #3
    Join Date
    Aug 2006
    Posts
    2

    QueryBean

    Hi Cem, team member,

    <cffunction name="iller" access="remote" returntype="query" output="false">
    <cfset var qryIslem = ""/>
    <cfquery name="qryIslem" datasource="#request.dsn#">
    select IL_ID as ID, AD
    from TBL_ILLER
    where 0=0
    order by AD
    </cfquery>
    <cfreturn qryIslem/>
    </cffunction>

    To improve your example, I sent above ColdFusion web service code. This ColdFusion function, returns a Query datatype. Your ASP.NET code converts the ColdFusion query (QueryBean) datatype to ASP.NET DataTable datatype.

    ---
    Esref Atak
    Say It With You're In Good Hand With Ottoman.

  4. #4
    Join Date
    Sep 2006
    Posts
    2
    Quote Originally Posted by esrefatak
    Hi Cem, team member,

    <cffunction name="iller" access="remote" returntype="query" output="false">
    <cfset var qryIslem = ""/>
    <cfquery name="qryIslem" datasource="#request.dsn#">
    select IL_ID as ID, AD
    from TBL_ILLER
    where 0=0
    order by AD
    </cfquery>
    <cfreturn qryIslem/>
    </cffunction>

    To improve your example, I sent above ColdFusion web service code. This ColdFusion function, returns a Query datatype. Your ASP.NET code converts the ColdFusion query (QueryBean) datatype to ASP.NET DataTable datatype.

    ---
    Esref Atak
    Say It With You're In Good Hand With Ottoman.
    esrefatak,

    Can you explain further on your example. I have a CFC that looks identical to that (except the query) but i still cant parse the QueryBean data with VB.net.

    Or is there any other solutions?

    Any help would be greatly appreciated.
    I'm using VB.net 2005

    gk

  5. #5
    Join Date
    Aug 2006
    Posts
    2

    What is error message?

    Quote Originally Posted by GrannyKlump
    esrefatak,

    Can you explain further on your example. I have a CFC that looks identical to that (except the query) but i still cant parse the QueryBean data with VB.net.

    Or is there any other solutions?

    Any help would be greatly appreciated.
    I'm using VB.net 2005

    gk

    Did occur an error? Write in here the error message. Did you applied above solution? Are you sure that your CFC function is correct? To sure; call the function via:

    <cfdump var="#createObject("component", "model.iletisim").iller()#"/>

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles