Below is the ClientsDAO (partial code) that shows the
createObject section that you mention and the ClientsGateway
(partial code)
I'm not sure what you mean by what is the calling code that's
generating that error. The title of the error box is
Server.Processing if that is what you mean.
When you go to the website it gives me the same error 4 times
then changes to say it can't find SerivceGateway, then when you say
OK, it gives the can't find ClientsGateway error once more. Hit OK
and the website is shown, but the connection to the database
doesn't work.
CLIENTSDAO.cfc
<cfcomponent output="false">
<cffunction name="read" output="false" access="public"
returntype="Darren21.src.cfc.Clients">
<cfargument name="id" required="true">
<cfset var qRead="">
<cfset var obj="">
<cfquery name="qRead" datasource="barbosa">
select clientID, fname, lname, address, city, state,
zip, hPhone, cPhone, email, pass,
comments, startDate, rate, ts
from bclients
where clientID = <cfqueryparam cfsqltype="CF_SQL_INTEGER"
value="#arguments.id#" />
</cfquery>
<cfscript>
obj = createObject("component",
"Darren21.src.cfc.Clients").init();
obj.setclientID(qRead.clientID);
obj.setfname(qRead.fname);
obj.setlname(qRead.lname);
obj.setaddress(qRead.address);
obj.setcity(qRead.city);
obj.setstate(qRead.state);
obj.setzip(qRead.zip);
obj.sethPhone(qRead.hPhone);
obj.setcPhone(qRead.cPhone);
obj.setemail(qRead.email);
obj.setpass(qRead.pass);
obj.setcomments(qRead.comments);
obj.setstartDate(qRead.startDate);
obj.setrate(qRead.rate);
obj.setts(qRead.ts);
return obj;
</cfscript>
</cffunction>
<cffunction name="create" output="false"
access="public">
<cfargument name="bean" required="true"
type="Darren21.src.cfc.Clients">
<cfset var qCreate="">
<cfset var qGetId="">
<cfset var local1=arguments.bean.getfname()>
<cfset var local2=arguments.bean.getlname()>
<cfset var local3=arguments.bean.getaddress()>
<cfset var local4=arguments.bean.getcity()>
<cfset var local5=arguments.bean.getstate()>
<cfset var local6=arguments.bean.getzip()>
<cfset var local7=arguments.bean.gethPhone()>
<cfset var local8=arguments.bean.getcPhone()>
<cfset var local9=arguments.bean.getemail()>
<cfset var local10=arguments.bean.getpass()>
<cfset var local11=arguments.bean.getcomments()>
<cfset var local12=arguments.bean.getstartDate()>
<cfset var local13=arguments.bean.getrate()>
<cfset var local15=arguments.bean.getts()>
<cftransaction isolation="read_committed">
<cfquery name="qCreate" datasource="barbosa">
insert into bclients(fname, lname, address, city, state,
zip, hPhone, cPhone, email, pass, comments, startDate, rate, ts)
values (
<cfqueryparam value="#local1#" cfsqltype="CF_SQL_VARCHAR"
/>,
<cfqueryparam value="#local2#" cfsqltype="CF_SQL_VARCHAR"
/>,
<cfqueryparam value="#local3#" cfsqltype="CF_SQL_VARCHAR"
/>,
<cfqueryparam value="#local4#" cfsqltype="CF_SQL_VARCHAR"
/>,
<cfqueryparam value="#local5#" cfsqltype="CF_SQL_CHAR"
/>,
<cfqueryparam value="#local6#" cfsqltype="CF_SQL_CHAR"
/>,
<cfqueryparam value="#local7#" cfsqltype="CF_SQL_CHAR"
/>,
<cfqueryparam value="#local8#" cfsqltype="CF_SQL_CHAR"
/>,
<cfqueryparam value="#local9#" cfsqltype="CF_SQL_VARCHAR"
/>,
<cfqueryparam value="#local10#"
cfsqltype="CF_SQL_VARCHAR" />,
<cfqueryparam value="#local11#"
cfsqltype="CF_SQL_LONGVARCHAR" />,
<cfqueryparam value="#local12#"
cfsqltype="CF_SQL_TIMESTAMP" null="#iif((local12 eq ""), de("yes"),
de("no"))#" />,
<cfqueryparam value="#local13#"
cfsqltype="CF_SQL_INTEGER" null="#iif((local13 eq ""), de("yes"),
de("no"))#" />,
<cfqueryparam value="#local15#"
cfsqltype="CF_SQL_TIMESTAMP" null="#iif((local15 eq ""), de("yes"),
de("no"))#" />
)
</cfquery>
<!--- If your server has a better way to get the ID that
is more reliable, use that instead --->
<cfquery name="qGetID" datasource="barbosa">
select last_insert_id() as clientID
from bclients
order by clientID desc
</cfquery>
</cftransaction>
<cfscript>
arguments.bean.setclientID(qGetID.clientID);
</cfscript>
<cfreturn arguments.bean />
</cffunction>
CLIENTSGATEWAY.cfc
<cfcomponent output="false">
<cffunction name="getById" output="false"
access="remote">
<cfargument name="id" required="true" />
<cfreturn createObject("component",
"ClientsDAO").read(arguments.id)>
</cffunction>
<cffunction name="save" output="false"
access="remote">
<cfargument name="obj" required="true" />
<cfscript>
if( obj.getclientID() eq 0 )
{
return createObject("component",
"ClientsDAO").create(arguments.obj);
} else {
return createObject("component",
"ClientsDAO").update(arguments.obj);
}
</cfscript>
</cffunction>
<cffunction name="deleteById" output="false"
access="remote">
<cfargument name="id" required="true" />
<cfset var obj = getById(arguments.id)>
<cfset createObject("component",
"ClientsDAO").delete(obj)>
</cffunction>
<cffunction name="getAll" output="false" access="remote"
returntype="Darren21.src.cfc.Clients[]">
<cfset var qRead="">
<cfset var obj="">
<cfset var ret=arrayNew(1)>
<cfquery name="qRead" datasource="barbosa">
select clientID
from bclients
</cfquery>
<cfloop query="qRead">
<cfscript>
obj = createObject("component",
"ClientsDAO").read(qRead.clientID);
ArrayAppend(ret, obj);
</cfscript>
</cfloop>
<cfreturn ret>
</cffunction>
<cffunction name="getAllAsQuery" output="false"
access="remote" returntype="query">
<cfargument name="fieldlist" default="*" hint="List of
columns to be returned in the query.">
<cfset var qRead="">
<cfquery name="qRead" datasource="barbosa">
select #arguments.fieldList#
from bclients
</cfquery>
<cfreturn qRead>
</cffunction>