Hi!
I'm trying to use odbc. So far I've got a dsn, can connect,
execute a query and retrieve the rows.
However, upon script exit the script crashes.

This is my script:

set db=createobject("ADODB.Connection")
db.open("dsn=ecadbib;uid=layoutchecks_hetzer;pwd=layoutchecks_hetzer")
set Rows=db.execute("select sysdate from dual")
do until Rows.EOF
msgBox(Rows("SYSDATE"))
Rows.MoveNext
loop
Rows.Close
msgbox("Here")
db.Close
msgbox("Here")

Now, whenever I leave out one of the two message boxes (or both),
the script crashes. It also crashes when I use wscript.createobject instead
of just createobject.

Does anyone have an idea what I'm doing wrong?
Btw, I'm trying to connect to an oracle database.

Lots of Greetings!
Volker

Re: fun with odbc... :-( by Bob

Bob
Mon Nov 07 08:12:18 CST 2005

Volker Hetzer wrote:
> Hi!
> I'm trying to use odbc.

Your first mistake ;-)
http://www.aspfaq.com/show.asp?id=2126

So far I've got a dsn, can connect,
> execute a query and retrieve the rows.
> However, upon script exit the script crashes.
>
> This is my script:
>
> set db=createobject("ADODB.Connection")
> db.open("dsn=ecadbib;uid=layoutchecks_hetzer;pwd=layoutchecks_hetzer")

You probably should have censored the password ...

> set Rows=db.execute("select sysdate from dual")
> do until Rows.EOF
> msgBox(Rows("SYSDATE"))
> Rows.MoveNext
> loop
> Rows.Close
> msgbox("Here")
> db.Close
> msgbox("Here")
>
> Now, whenever I leave out one of the two message boxes (or both),
> the script crashes. It also crashes when I use wscript.createobject
> instead of just createobject.
>
What kind of crash? Are you forced to reboot your machine? Kill the process
using Task Manager? Do you get an error message?

FWIW, I see nothing glaringly wrong here.

Maybe try explicitly setting the ADO objects to Nothing:
Rows.Close: Set Rows=Nothing
db.Close: Set db = Nothing

Bob Barrows

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.



Re: fun with odbc... :-( by Volker

Volker
Mon Nov 07 09:12:13 CST 2005

Bob Barrows [MVP] wrote:
> Volker Hetzer wrote:
>
>>Hi!
>>I'm trying to use odbc.
>
>
> Your first mistake ;-)
> http://www.aspfaq.com/show.asp?id=2126
Ok, I tried a connection string, if I really need to use
odbc or oledb I'll try again.

>
> So far I've got a dsn, can connect,
>
>>execute a query and retrieve the rows.
>>However, upon script exit the script crashes.
>>
>>This is my script:
>>
>>set db=createobject("ADODB.Connection")
>>db.open("dsn=ecadbib;uid=layoutchecks_hetzer;pwd=layoutchecks_hetzer")
>
>
> You probably should have censored the password ...
Don't worry about the password :-)

>
>
>>set Rows=db.execute("select sysdate from dual")
>>do until Rows.EOF
>>msgBox(Rows("SYSDATE"))
>>Rows.MoveNext
>>loop
>>Rows.Close
>>msgbox("Here")
>>db.Close
>>msgbox("Here")
>>
>>Now, whenever I leave out one of the two message boxes (or both),
>>the script crashes. It also crashes when I use wscript.createobject
>>instead of just createobject.
>>
>
> What kind of crash? Are you forced to reboot your machine? Kill the process
> using Task Manager? Do you get an error message?
I get a message, looks like a typical memory error. (Instruction at 0x7c921e58
points to 0xffffffff.)

>
> FWIW, I see nothing glaringly wrong here.
>
> Maybe try explicitly setting the ADO objects to Nothing:
> Rows.Close: Set Rows=Nothing
> db.Close: Set db = Nothing
Tried that too, no difference.

I'm beginning to suspect oracles odbc driver.
However, since using oracles own oledb server works flawlessly
I'm inclined to use that one, unless my boss forces me into the standard
driver.

Lots of Greetings and thanks!
Volker