Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ODBC data connection vs. conn string pass to recordset? 1

Status
Not open for further replies.

XgrinderX

Programmer
Mar 27, 2001
225
US
Ok I have a dilemma with my web host. If you want to skip the drama, scroll down to THE QUESTION.

They recently upgraded my account and moved me to all new servers, this was at the end of Feb. On Mar 13 they did some patches, including W2K3 SP2. On Mar 14 I started receiving error reports from my client about pages throwing the following error:

A trappable error (C0000005) occurred in an external object. The script cannot continue running.

Since then I have been going back and forth with them. They are telling me its my code. But the same code works on every other web server I have run it on. They claim that some of their security settings or something is causing us to have to change some of our code to make it work.

Instead of creating and ADODB.Connection and then setting that connection as active for recordsets by using rs.ActiveConnection = dbc, they want us to instead use rs.Open strSQL,strConn.

THE QUESTION:
Is there any valid reason to use rs.Open strSQL,strConn over rs.ActiveConnection = dbc? Is there a security issue I am unaware of? Is this method more/less efficient? I assume I still need to create a data connection to execute insert/update/delete queries.....or is there a way to do it that I am unaware of?

I've been coding this same way for years and am pretty much self taught, so I am open to the possibility that the way I have been doing it is not the best way. Enlighten me oh bright Tek-Tips posters!!

-Greg
 
greg,

Usually that error is because of a comm object/permissions pass through problem. I've also seen it with older MDAC 's but that dosent seem to be the case.
If doing it their way fixes it then why not try it? If it fails then you can rub it in HA.

It may very well be a security item that they have set up or don't know the set it up.
 
Yeah all the errors that I have discovered are happening on recordset objects. The running theme seems to be if I open a recordset while looping through some other stuff. For example (pseudo-code):

rs1.open
do while not rs1.eof
code
code
rs2.open <-- error usually occurs here
get value from rs2
rs2.close
loop
rs1.close

The odd thing is, it will make it through at least one and sometimes 2 iterations of that loop before deciding to error.

Anyway, the real thing I am wondering is if the method they are suggesting is in any way less efficient or causes more stress on the web or data server in any way? If not then no worries.

-Greg
 
I inherited porjects that use there suggested way and left the code intact nad never noticed any problems or slow downs. To me its just a preference issue.

 
I agree with DAshley... I have used both and never noticed a difference one way or another.
 
Thanks for the input you two.

Presumably I will still have to open a data connection to execute INSERT/UPDATE/DELETE statements? I've never done it any other way.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top