Link to home
Start Free TrialLog in
Avatar of BooH
BooH

asked on

For Wizard2 - Need clarification re: SQLExec(), etc.

I apologize, as re-reading my question and your answer leads me to believe I didn't phrase the question right.  I appear to be able to successfully connect to the database, and have set up the SQLCmd() and SQLExec appropriately.  I just can't figure out how to deal with the query results.  

Previously, I'd been able to route all the results of the query into the new recordset by setting the database and then using that database as part of the definition for the new recordset.  (' Set db = (....)', and then 'Set gSrchSet = db.OpenRecordset(....)')

How do I do that now?  In all the examples in the books, it seems to only reference 'results%' which is an integer, not a database or a recordset. (Plus they don't seem to ever show examples of what to do with any data that's returned, but that's another story!)  Is it that I can no longer 'set' the database?  If I can't do that, how do I define the recordset to hold the results of the query?

I'm just really stuck.  I do appreciate your original answer, and I'm hoping you understand why I'm still stuck.  Sorry if this isn't the right way to contact you, but I didn't see anywhere in the grading sheet where I could reply to the expert.

Thanks again!      
Avatar of wizard2072098
wizard2072098

Unfortunately, when you deal directly with SQL, you're stuck not having recordset capability. The recordset is being maintained by the server, which is why you only have a "results%" integer. DAO, RDO, and ADO wrap the results into a recordset that allows you more freedom in the way you work with the records. With direct SQL, you'll have to use SQL commands to navigate the records without having the advantage of having a recordset object.

Remember, what you're dealing with when you run direct SQL is clear text records coming back to your machine from the server. There is no "object" that you can manipulate. That explains why you can't assign it to a recordset object. I guess if you wanted to you could create your own recordset-type class and read all the records into it from the server -- and you'd pretty much be duplicating the functionality that DAO, RDO, and ADO provide.

Working with direct SQL is nice in some cases, since you're foregoing all the overhead involved with class-based recordset access, but it's really kind of a pain in the butt because of all the extra coding involved.
ASKER CERTIFIED SOLUTION
Avatar of wizard2072098
wizard2072098

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial