Hi all, I have the DSN-less connection working so I can connect to a database without needing a datasource defined in ColdFusion Administrator. Now I'm trying to put the functionality into a CFC so users can call it to connect, then send queries to it and get back recordsets.
I have a method that will connect to the database -- that's working. The issue is the next method that queries the connection. How do I pass that connection from one method to the other?
The first method basically does this at the end:
Should I return something? What's the type?
The next method will take a SQL string like the following, but what do I put in the "UNKNOWN" part?
I'm not sure how to tie these things together, so any pointers would be very appreciated. Thanks!
I have a method that will connect to the database -- that's working. The issue is the next method that queries the connection. How do I pass that connection from one method to the other?
The first method basically does this at the end:
Code:
<cfobject type="COM" name="methodConn" class="ADODB.Connection" action="CREATE">
<cfset dsn = "DRIVER=#Driver#;SERVER=#ARGUMENTS.hostname#;DATABASE=#ARGUMENTS.database#">
<cfset thisConn = methodConn.Open("#dsn#", "#ARGUMENTS.username#", "#ARGUMENTS.password#", -1)>
Should I return something? What's the type?
The next method will take a SQL string like the following, but what do I put in the "UNKNOWN" part?
Code:
<cfset recordset = UNKNOWN.Execute(ARGUMENTS.sql, 0, 8)>
I'm not sure how to tie these things together, so any pointers would be very appreciated. Thanks!