Click to See Complete Forum and Search --> : queryBean datatype conversion
mrobertson
12-02-2004, 04:34 PM
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.
cemaksoy
07-26-2006, 04:19 AM
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.....
esrefatak
08-14-2006, 01:58 AM
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.
GrannyKlump
09-01-2006, 08:19 AM
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
esrefatak
09-05-2006, 03:36 AM
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()#"/>