RE: ActiveX DLL to return a collection with CFOBJECT
Looks like you're trying to handle the ADO recordset being returned like you would in ASP. Note that CF really doesn't know how to handle ADO recordsets - you'll probably want to write a wrapper object (or change the current one) to place the recordset into an array (which I *think* CF has no problem with) --- Billy Cravens -Original Message- From: David Jones [mailto:[EMAIL PROTECTED]] Sent: Friday, April 26, 2002 10:03 AM To: CF-Talk Subject: ActiveX DLL to return a collection with CFOBJECT Hi All, I'm a new subscriber to the list and about 3 projects new to CF. I recently posted a message but was unsure if it got to the rest of you. So please paron me if you receive this as a dubplicate. I am having trouble returning a collection with the cfobject command. Any help would be appreciated. I have an ActiveX Dll with the Prog-ID:ghZipLocator.clsghZipLocator inside that I have a method/function called GetCompanyNames. GetCompanyNames returns a recordset. Which works well in ASP. Here is my code for the getCompanyNames method in Prog-ID:ghZipLocator.clsghZipLocator. You will see it is very simple. Public Function getCompanyNames(ByVal strDsn As String, ByVal strDsnUserid As String, ByVal _ strDsnPasswd As String) As Variant On Error GoTo err1 Dim connlogin As New ADODB.Connection Dim rsResult As New ADODB.Recordset Dim sqlCompany As String connlogin.Open strDsn, strDsnUserid, strDsnPasswd sqlCompany = SELECT Company_Name, CompanyID _ FROM GH_COMPANY_INFO Set rsResult = connlogin.Execute(sqlCompany) Set getCompanyNames = rsResult Exit Function err1: Err.Raise Err.Number, Err.Source, Err.Description End Function Here is my CF code. CFSET dsnname = gHarvest CFSET dsnuser = sa CFSET dsnpass = CFOBJECT ACTION=Create NAME=obj CLASS=ghZipLocator.clsghZipLocator CFSET MyRecordset=obj.GetCompanyNames(#dsnname#,#dsnuser#,#dsnpass#) CFLOOP COLLECTION=#MyRecordset# ITEM=file2 CFOUTPUT #file2.Company_Name# /CFOUTPUT /CFLOOP Everything seem to work fine until it get to the loop. At this point I get the following error. unknown exception condition unknown error while executing a tag. I can send the VB project code if any of you think it may be helpful. If I am doing this incorrectly, an example of the correct procedure would be greatly appreciated. Thanks, David __ Your ad could be here. Monies from ads go to support these lists and provide more resources for the community. http://www.fusionauthority.com/ads.cfm FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
Re: ActiveX DLL to return a collection with CFOBJECT
I don't have a solid answer but there area few things to keep in mind when working with COM with cfobject. CF pukes when you try to reference anything with a null value passed back from a com object. CF pukes if you reference a piece of data that is one of the less common datatypes in an ADO recordset (like sql server's decimal). I'm sure the list is a lot longer...I just know these two from experience. I will say that i've seen the exact problem you have more than once, and almost everytime it is because I am trying to reference a null. If you haven't already, go to http://www.cfcomet.com and read their write-up on using ADO from within CF and the comments in the forum. I have successfully used ADO with cfobject, but it can be very picky. The null problem alone can be a showstopper sometimes though. jon - Original Message - From: David Jones [EMAIL PROTECTED] To: CF-Talk [EMAIL PROTECTED] Sent: Friday, April 26, 2002 11:02 AM Subject: ActiveX DLL to return a collection with CFOBJECT Hi All, I'm a new subscriber to the list and about 3 projects new to CF. I recently posted a message but was unsure if it got to the rest of you. So please paron me if you receive this as a dubplicate. I am having trouble returning a collection with the cfobject command. Any help would be appreciated. I have an ActiveX Dll with the Prog-ID:ghZipLocator.clsghZipLocator inside that I have a method/function called GetCompanyNames. GetCompanyNames returns a recordset. Which works well in ASP. snip Everything seem to work fine until it get to the loop. At this point I get the following error. unknown exception condition unknown error while executing a tag. I can send the VB project code if any of you think it may be helpful. If I am doing this incorrectly, an example of the correct procedure would be greatly appreciated. Thanks, David __ This list and all House of Fusion resources hosted by CFHosting.com. The place for dependable ColdFusion Hosting. FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
RE: ActiveX DLL to return a collection with CFOBJECT
Thanks, I was actually wondering that same thing. I was just about to try doing that. Changing the object to return an array I mean. Also I was wondering if anyone had an example of a component that does something similar to what I am trying to do. I don't want an proprietary information or anything. I just want to look at which references are assigned and how the methods and properties are laid out. Basically I want to see a component that for sure works with CF so that I can be sure of why mine do not. Thanks, Dave -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Friday, April 26, 2002 11:19 AM To: CF-Talk Subject: RE: ActiveX DLL to return a collection with CFOBJECT Looks like you're trying to handle the ADO recordset being returned like you would in ASP. Note that CF really doesn't know how to handle ADO recordsets - you'll probably want to write a wrapper object (or change the current one) to place the recordset into an array (which I *think* CF has no problem with) --- Billy Cravens -Original Message- From: David Jones [mailto:[EMAIL PROTECTED]] Sent: Friday, April 26, 2002 10:03 AM To: CF-Talk Subject: ActiveX DLL to return a collection with CFOBJECT Hi All, I'm a new subscriber to the list and about 3 projects new to CF. I recently posted a message but was unsure if it got to the rest of you. So please paron me if you receive this as a dubplicate. I am having trouble returning a collection with the cfobject command. Any help would be appreciated. I have an ActiveX Dll with the Prog-ID:ghZipLocator.clsghZipLocator inside that I have a method/function called GetCompanyNames. GetCompanyNames returns a recordset. Which works well in ASP. Here is my code for the getCompanyNames method in Prog-ID:ghZipLocator.clsghZipLocator. You will see it is very simple. Public Function getCompanyNames(ByVal strDsn As String, ByVal strDsnUserid As String, ByVal _ strDsnPasswd As String) As Variant On Error GoTo err1 Dim connlogin As New ADODB.Connection Dim rsResult As New ADODB.Recordset Dim sqlCompany As String connlogin.Open strDsn, strDsnUserid, strDsnPasswd sqlCompany = SELECT Company_Name, CompanyID _ FROM GH_COMPANY_INFO Set rsResult = connlogin.Execute(sqlCompany) Set getCompanyNames = rsResult Exit Function err1: Err.Raise Err.Number, Err.Source, Err.Description End Function Here is my CF code. CFSET dsnname = gHarvest CFSET dsnuser = sa CFSET dsnpass = CFOBJECT ACTION=Create NAME=obj CLASS=ghZipLocator.clsghZipLocator CFSET MyRecordset=obj.GetCompanyNames(#dsnname#,#dsnuser#,#dsnpass#) CFLOOP COLLECTION=#MyRecordset# ITEM=file2 CFOUTPUT #file2.Company_Name# /CFOUTPUT /CFLOOP Everything seem to work fine until it get to the loop. At this point I get the following error. unknown exception condition unknown error while executing a tag. I can send the VB project code if any of you think it may be helpful. If I am doing this incorrectly, an example of the correct procedure would be greatly appreciated. Thanks, David __ Signup for the Fusion Authority news alert and keep up with the latest news in ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
RE: ActiveX DLL to return a collection with CFOBJECT
Thanks, I'll do that. I don't absolutely have to use ADO, it just so happened that the component I picked to test with returned an ADO record set. To be honest, the components I write in the future will more than likely return arrays anyway. I believe this will help performance in the long haul when traffic picks up. I read some where that record sets take up more resources. I'll read up on it anyway though. I'm glad I found this list. Nothing is a better teacher than experience and I'm sure there is a lot of experience in here. I searched and search the web for help on my problem and didn't find anything except examples of things that didn't work for me.. Lol. Thanks, Dave -Original Message- From: Jon Hall [mailto:[EMAIL PROTECTED]] Sent: Friday, April 26, 2002 11:32 AM To: CF-Talk Subject: Re: ActiveX DLL to return a collection with CFOBJECT I don't have a solid answer but there area few things to keep in mind when working with COM with cfobject. CF pukes when you try to reference anything with a null value passed back from a com object. CF pukes if you reference a piece of data that is one of the less common datatypes in an ADO recordset (like sql server's decimal). I'm sure the list is a lot longer...I just know these two from experience. I will say that i've seen the exact problem you have more than once, and almost everytime it is because I am trying to reference a null. If you haven't already, go to http://www.cfcomet.com and read their write-up on using ADO from within CF and the comments in the forum. I have successfully used ADO with cfobject, but it can be very picky. The null problem alone can be a showstopper sometimes though. jon - Original Message - From: David Jones [EMAIL PROTECTED] To: CF-Talk [EMAIL PROTECTED] Sent: Friday, April 26, 2002 11:02 AM Subject: ActiveX DLL to return a collection with CFOBJECT Hi All, I'm a new subscriber to the list and about 3 projects new to CF. I recently posted a message but was unsure if it got to the rest of you. So please paron me if you receive this as a dubplicate. I am having trouble returning a collection with the cfobject command. Any help would be appreciated. I have an ActiveX Dll with the Prog-ID:ghZipLocator.clsghZipLocator inside that I have a method/function called GetCompanyNames. GetCompanyNames returns a recordset. Which works well in ASP. snip Everything seem to work fine until it get to the loop. At this point I get the following error. unknown exception condition unknown error while executing a tag. I can send the VB project code if any of you think it may be helpful. If I am doing this incorrectly, an example of the correct procedure would be greatly appreciated. Thanks, David __ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
Re: ActiveX DLL to return a collection with CFOBJECT
For fun I converted the JavaScript ADO definitions into a CF include file and posted an example of running through a recordset that way... It may help? http://cfhub.com/advanced/ado/ Basically I want to see a component that for sure works with CF so that I can be sure of why mine do not. Thanks, Dave __ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
RE: ActiveX DLL to return a collection with CFOBJECT
Yeah I read this yesterday while looking for an answer to my problem. I almost tried it, just for the hell of it... I was able to get my component working to return an array. Thanks for everyone's advice. Dave. -Original Message- From: Joseph Thompson [mailto:[EMAIL PROTECTED]] Sent: Friday, April 26, 2002 12:37 PM To: CF-Talk Subject: Re: ActiveX DLL to return a collection with CFOBJECT For fun I converted the JavaScript ADO definitions into a CF include file and posted an example of running through a recordset that way... It may help? http://cfhub.com/advanced/ado/ Basically I want to see a component that for sure works with CF so that I can be sure of why mine do not. Thanks, Dave __ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists